# Frames won't play when character jumps

**URL:** <https://phaser.discourse.group/t/frames-wont-play-when-character-jumps/2467>\
**Category:** Phaser 3\
**Created:** [May 15, 2019, 8:13pm UTC](https://phaser.discourse.group/t/frames-wont-play-when-character-jumps/2467 "2019-05-15T20:13:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![iamvalecia](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/iamvalecia/32/2957_2.png) [@iamvalecia](https://phaser.discourse.group/u/iamvalecia)\
**Post date:** [May 15, 2019, 8:13pm UTC](https://phaser.discourse.group/t/frames-wont-play-when-character-jumps/2467/1 "2019-05-15T20:13:54Z")

</div>

I want the dino change frames when he’s jumping, not to use the same frame as when he’s standing.

[Github repo](https://github.com/iamvalecia/save-a-dino/blob/master/game.js) Lines 67-72 and 104-107

> this.anims.create({  
> key: ‘jump’,  
> frames: this.anims.generateFrameNumbers(‘dino’, { start: 5, end: 6 }),  
> frameRate: 10,  
> repeat: -1  
> });

Then in the update function

> if (cursors.up.isDown && dino.body.touching.down){  
> dino.setVelocityY(-330);  
> dino.anims.play(‘jump’, true);  
> }

Any help will be appreciated.

---

<div class="post-metadata">

**Author:** ![jppresents](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/jppresents/32/1266_2.png) [@jppresents](https://phaser.discourse.group/u/jppresents)\
**Post date:** [May 17, 2019, 2:29pm UTC](https://phaser.discourse.group/t/frames-wont-play-when-character-jumps/2467/2 "2019-05-17T14:29:00Z")

</div>

The problem seems to be, that you switch between animations every update.  
You have play(“stand”) in the update function which is always called.  
This overwrites the “jump” animation instantly.

You will have to implement the code in a way that you only call play for one animation each update, so that this animation has a chance to play.

---

<div class="post-metadata">

**Author:** ![iamvalecia](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/iamvalecia/32/2957_2.png) [@iamvalecia](https://phaser.discourse.group/u/iamvalecia)\
**Post date:** [May 19, 2019, 3:17am UTC](https://phaser.discourse.group/t/frames-wont-play-when-character-jumps/2467/3 "2019-05-19T03:17:52Z")

</div>

That really helped. Thanks. Also I checked your work. I really liked the bird game.
