Good luck.
thank you so much :)
Hope this helps. Feel free to break apart the code and adapt it to what you are doing. Sorry, it took a while, I am 13 and I wouldn’t call myself “knowledgeable” in Lua and Corona SDK.
This is perfect extremely helpful thank you soo much!! I just have one last question how would I add a touch event listener to the sprite so it begins when I touch an object and I have a total of 4 objects.
Well, in order to do that, you would have to add the touch listener to the objects, not to the sprite, then you would just set the sprite to begin playing its animation.
If you want 4 objects, you would do:
local objects = {} local object local i local function onObjectTouch( event ) if ( event.phase == "ended" ) then soldier:setSequence("speedWalk") soldier:play() end return true end for i = 1, 4 do object = display.newRect(100, i \* 75, 50, 50) object = objects[i] end objects[i].touch = onObjectTouch objects[i]:addEventListener( "touch", objects[i] )
I figured it out, took me a while but I messed around with the code and it worked Thank you for the help though! I really appreciate it!
Your welcome.