Sprite animations after button released and btn then play the idle again.

Hey guys I cant seem to figure out how to make it so after you release the move right button it goes back to the idle animation from the running. I just need to set the sequence and play the idle sheet after release of btnR.

Thanks! Tyler Jacobson

 function btnR:touch() motionx = speed; local function swapSheet() --eric is main character. eric:setSequence( "run" ) eric:play() end timer.performWithDelay( 200, swapSheet ) end btnR:addEventListener("touch",btnR)

I don’t know if this is the issue or not, but Corona touch events have multiple phases:

event.phase == “began”

event.phase == “moved”

event.phase == “ended”

event.phase == “cancelled”.

Every touch event will get triggered at least twice, once for the “began” and once when the “ended” phase happens. You might get multiple “moved” phases in between.  Since you’re not testing for the phase, your timer will get called multiple times.

Rob

I don’t know if this is the issue or not, but Corona touch events have multiple phases:

event.phase == “began”

event.phase == “moved”

event.phase == “ended”

event.phase == “cancelled”.

Every touch event will get triggered at least twice, once for the “began” and once when the “ended” phase happens. You might get multiple “moved” phases in between.  Since you’re not testing for the phase, your timer will get called multiple times.

Rob