Hey Renato I got yours to work but it only made the movement one time and I couldn’t make it do anything more. It wouldn’t move every time I clicked. And Brent I think I got everything right with yours from that post just to see exactly what it does and try to understand it but right now I have nothing working… no errors. I’ll post what I have below… I’ll go ahead and clarify what it is I’m looking for. I want my rocket object to be moved around by a touch on the screen. If you hold and drag the touch I want it to follow it or if you click the top and then click the bottom I want it to go straight to that touch without disappearing. The object will never spin or change direction it will always point forward. If you have any more questions let me know and I appreciate all the help so far.
[lua]function screenTouch (event)
local xVal = event.xStart - event.x
local yVal = event.yStart - event.y
if event.x <= 150 then
if (math.abs(yVal) > 2) then
local factor = 2 / math.abs(yVal)
xVal = xVal * factor
yVal = yVal * factor
elseif (math.abs(xVal) > 2 ) then
local factor = 2 / math.abs(xVal)
xVal = xVal * factor
yVal = yVal * factor
end
print(“Works”)
end
end
rocket:applyLinearImpulse(xVal, yVal)
Runtime:addEventListener(“touch”, screenTouch)[/lua] [import]uid: 20272 topic_id: 35556 reply_id: 141578[/import]
