i want my character to aim at were i click, but the results i am getting are wierd.
could i get a little help.
here is the code:
[lua]local physics = require(“physics”)
local gameUI = require(“gameUI”)
physics.start()
physics.setGravity( 0, 0 )
firefighter = display.newImage( “fireman.png”,400,720)
physics.addBody( firefighter, { density = 200000,friction=0, bounce=0,radius=25} )
function rotatingTheFirefighter(event)
a=firefighter.y-event.y
b=event.x-firefighter.x
goalRotation= math.deg(math.atan(a/b))
if event.phase==“began” then
transition.to(firefighter, { time=15, rotation = goalRotation })
elseif event.phase==“moved” then
transition.to(firefighter, { time=15, rotation = goalRotation })
end
end
Runtime:addEventListener(“touch”, rotatingTheFirefighter)[/lua]
thanks in advance
[import]uid: 28068 topic_id: 7460 reply_id: 307460[/import]