Is it possible to move a character or sprite around the screen without buttons.
example , i touch in the screen and the character move.
I want to move a character from left to right .
I don’t want to drag the character.
Is it possible to move a character or sprite around the screen without buttons.
example , i touch in the screen and the character move.
I want to move a character from left to right .
I don’t want to drag the character.
Yes, you can make invisible buttons
(I would call it touch area)
You can also make the whole screen touchable and move your sprite towards the touch, or look and see if the touch is left or right of the sprite and move it accordingly.
Where Can I find information about touching the whole screen ?
I see examples of touching buttons and then move,
But I don’t understand how to touch the screen and move a sprite.
You just draw big newRect, make it invisible, set .isHitTestable to true and addEventListener for touch event for this rect.
This touch function will be responsible for eg your spritr movement.
You can add your touch handler to the current stage and possibly even the Runtime!
display.currentStage:addEventListener( “touch”, moveSprite )
or
Runtime:addEventListener(“touch”, moveSprite)
Yes, you can make invisible buttons
(I would call it touch area)
You can also make the whole screen touchable and move your sprite towards the touch, or look and see if the touch is left or right of the sprite and move it accordingly.
Where Can I find information about touching the whole screen ?
I see examples of touching buttons and then move,
But I don’t understand how to touch the screen and move a sprite.
You just draw big newRect, make it invisible, set .isHitTestable to true and addEventListener for touch event for this rect.
This touch function will be responsible for eg your spritr movement.
You can add your touch handler to the current stage and possibly even the Runtime!
display.currentStage:addEventListener( “touch”, moveSprite )
or
Runtime:addEventListener(“touch”, moveSprite)