I’ve been working on finding a way to make an object travel at an angle. Right now I have a little set up I think I can use to find the angle of my object to travel.
[lua]local function screenTouch (event)
local O
local A
local angle
if event.x <= 150 then
if event.x < rocket.x and event.y < rocket.y then
A = rocket.x - event.x
O = rocket.y - event.y
angle = math.deg(math.atan(O/A))
print("Angle: " … angle)
end
end
end
Runtime:addEventListener(“touch”, screenTouch)[/lua]
With that how would I go about making my rocket travel the angle touched. I figure I would have to write a few if statements to test where the click is so the rocket can go 360 deg and not just 0-90. Other than that I’ve searched and found nothing on applied forces or anything. Any help on how to accomplish this would be appreciated. [import]uid: 20272 topic_id: 35556 reply_id: 335556[/import]