Jump to content

Recommended Posts

Hi all,

 

I'm making a shmup game at the moment. I'm trying to animate player's diagonal movements but can't get it to work. Any help you could offer would be greatly appreciated.

 

First, I created the animation:

        this.anims.create({
          key: 'rightUp',
          frames: this.anims.generateFrameNumbers('player', { start: 30end: 33 }),
          frameRate: 10,
          repeat: -1
        });

 

then when the player wants to go up&&right:

        if(this.keyLeft.isDown&&this.keyUp.isDown){
          this.player.anims.play('rightUp'true);
          var isPaused = this.player.anims.currentAnim;
          var progress = this.player.anims.getProgress();
          // console.log(isPaused)
          console.log(progress)
        }

 

Everything else works perfectly fine (e.g. left, right, up, and down).

My console just returns 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 when I press the up and left arrow at the same time. In contrast for any other motion, it returns the frame number it's playing.

 

Thank you in advance,

Bong

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...