Page 1 of 1

pause a sprite?

Posted: Thu Apr 27, 2017 9:27 pm
by matteus
How can I pause a sprite animation on the last frame and stop it looping?

Re: pause a sprite?

Posted: Thu Apr 27, 2017 11:38 pm
by djcouchycouch
give the animation a loop variable. 1 means loop and 0 means don't loop. When you're incrementing the frame index, add a check: if it reaches the last frame and the loop variable is 0, then don't increment. It'll stay at the last frame.

Re: pause a sprite?

Posted: Fri Apr 28, 2017 8:25 am
by Stef
If you are using SGDK sprite engine, also be sure to set the time parameter in the resource definition to 0 so you can manually control the animation for this sprite using SPR_nextFrame(..) or SPR_setFrame(..) methods.