hi,
Does anyone have a code example where tap the screen an object moves in this direction?
I’ve looked in the SampleCode and on the forum, I found nothing about it.
Thank you if you go through here with an answer
hi,
Does anyone have a code example where tap the screen an object moves in this direction?
I’ve looked in the SampleCode and on the forum, I found nothing about it.
Thank you if you go through here with an answer
Hello espace3D, could you please rephrase your question ? I don’t think I understood it well.
Maybe
transition.to(object, {time=XXX, x=event.x, y=event.y})
in the Tap event could do it.
I did not quite describe my issue and since I can move my character with what you have specified.
Now, I try to add an event listener on a table so as to move my character at the center of the target cell.
the problem is, it is impossible for me to add an event listener on a table it returns nil me
Try this:
-- touch listener function function touch( self, event ) if event.phase == "ended" then transition.to( self, { x = event.x, y = event.y, time = 500 } ) end return true end local myObject = display.newRect( 0, 0, 100, 100 ) myObject:setFillColor( 255 ) myObject.touch = touch Runtime:addEventListener( "touch", myObject )
Hello espace3D, could you please rephrase your question ? I don’t think I understood it well.
Maybe
transition.to(object, {time=XXX, x=event.x, y=event.y})
in the Tap event could do it.
I did not quite describe my issue and since I can move my character with what you have specified.
Now, I try to add an event listener on a table so as to move my character at the center of the target cell.
the problem is, it is impossible for me to add an event listener on a table it returns nil me
Try this:
-- touch listener function function touch( self, event ) if event.phase == "ended" then transition.to( self, { x = event.x, y = event.y, time = 500 } ) end return true end local myObject = display.newRect( 0, 0, 100, 100 ) myObject:setFillColor( 255 ) myObject.touch = touch Runtime:addEventListener( "touch", myObject )