Learning how to start an animation is one thing, pausing it is another. When it’s game over, or if we decide to include a pause option, we might opt to pause one or all of our animations.

In Phaser, we can call exampleSprite.anims.pause() on the sprite to put a pause on its animation.

We can also call this.anims.pauseAll() to pause all animations in a Scene.

Let’s try out these convenient methods in our own game.



We’ve included animated snowmen in the middle of the main platform. We also added in an Overlap object that checks when Codey comes in contact with a snowman, it works very similarly to a Collider object except it allows the sprites to overlap.

The Overlap object is in the create() method. Inside the callback function of the Overlap object, pause the animation of the snowman when the two sprites come into contact. Do this by calling gameState.enemy.anims.pause().

Test out what happens in the game after you clear this checkpoint!


We’ve paused one snowman animation, but let’s see what happens when we pause all the animations!

Inside the same callback function of the previous step, call this.anims.pauseAll().

Take this course for free

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?