Hi all,
Here is a bit of code that i thought would work like iOS converting CGPoints to move an object… But I get a choppy movement actually the player moves where it is directed to by code. But what I want to achieve is a smooth movement of the Player with my finger along the X axis… Where did i go wrong ? I thought the playerAlex.hasFocus = true would accomplish that.
local function onObjectTouch( event )
if event.phase == “began” then
playerAlex.hasFocus = true
display.getCurrentStage():setFocus(playerAlex)
playerAlex.x = event.x
elseif event.phase == “ended” then
playerAlex.x = event.x
end
return true
end
Runtime:addEventListener(“touch”,onObjectTouch)
Thanks
JZ