How can I change the speed of a sprite animation in Game Maker Studio?

Welcome to the Game Maker Studio tutorial. Today we are going to see how to stop, slow down, stop or speed up the animation of a sprite (you know, those little images that represent the characters, objects and scenery in your game).

When we use assets in our game, it is possible to animate them to give them life. However, it can happen that we want to stop this animation at a specific moment. To do this, we can use the variable image_speed.

image_speed what is it?

image_speedAs its name suggests, the speed of the animation of the images of a sprite can be controlled. This variable is what GMS calls a "built-in variable i.e. it is automatically defined by GameMaker Studio in each sprite we create. It is possible to find this type of variable because their name is written in green by default in our IDE.

This variable will act as a multiplier for the number of frames per second (FPS) of our sprite and its default value is 1. If the speed of your sprite is 10FPS andimage_speed is 2 then the animation is played at the following speed: 10FPS * 2 = 20FPS. This way, your asset will be animated twice as fast.

// Pour modifier la vitesse d'une animation
image_speed = 1;   // par défaut (100%)
image_speed = 2;   // 2x plus vite (200%)
image_speed = .5;  // 2x moins vite (50%)
image_speed = -3;  // sens inversé et 3x plus vite  (-300%)

If you want to see the whole process, here is the video tutorial in French that I created for the occasion.

To go further with the animations

If you want to stop the animation more gradually, you can use this line in your Step event: image_speed -= delta. This reduces the speed of the animation by delta each time we go into the step event, which allows a smoother transition to the complete stop, when image_speed is equal to 0.

In the same way, if we want to launch the animation only when our character moves, we must write :

// Step event
// la variable state contient l'état de notre personnage

if(state == "run") {
    image_speed = 1;
} else {
    image_speed = 0,


That's it! Now you know how to stop the animation of a sprite in Game Maker Studio. This tip can be useful in many situations, so feel free to use it in your next project. Thanks for reading this tutorial and see you soon for more Game Maker Studio tips!

Leave a comment

Your email address will not be published. Required fields are marked with *.