pause a sprite?

SGDK only sub forum

Moderator: Stef

Post Reply
matteus
Very interested
Posts: 330
Joined: Mon Feb 04, 2008 1:41 pm

pause a sprite?

Post by matteus » Thu Apr 27, 2017 9:27 pm

How can I pause a sprite animation on the last frame and stop it looping?

djcouchycouch
Very interested
Posts: 672
Joined: Sat Feb 18, 2012 2:44 am

Re: pause a sprite?

Post by djcouchycouch » Thu Apr 27, 2017 11:38 pm

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.

User avatar
Stef
Very interested
Posts: 2627
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Re: pause a sprite?

Post by Stef » Fri Apr 28, 2017 8:25 am

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.

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests