S2jS
Learn
Create Your Own
Split Screen
Next Page
Here's the plan:
- We'll add an animation_rate property to MySprite. This is how many frames go through before the sprite automatically switches to the next costume.
- We'll need a counter for each sprite to keep track of how many frames have gone through
- In the sprites Do_Frame_Things function, we'll see if it's time to change costumes.
- To start the animation running, we just set animation_rate accordingly
- To stop the animation, we just set animation_rate to zero
Once done, an animated sprite becomes just as easy as an unanimated sprite (apart from creating the image).