Hi Everyone,
I have a sprite packed in Spriteloq and I would like to add an event listener to it in the game. For example, while the sprite is going through its animations, I'd like to be able to drag it around the screen.
I tried the following, which does not work:
1 2 3 4 5 6 7 | -- create spritegroup instance above, then the following local function dragSprite(event) mySprite.x = event.x mySprite.y = event.y end mySprite:addEventListener("touch", dragSprite) |
Look at the the DragMeMultiTouch sample code. It's self-explanatory for moving display objects around on screen. Have a look and see if that is what you need.
-David
Yes as David said.
Look at the Interface/DragMe sample in the Corona Sample Code.