Jump to content

Character Dash [HELP]


Recommended Posts

  • 3 weeks later...

Let's see what is a dash?

I think on it as a fast increase of speed that go down again to normal speed after second or less.


So, when a "x" key is "just down" increase the player speed a 100% (maybe).



//phaser 3

//inside the update method.

var speed = 10;

if(Phaser.Input.Keyboard.JustDown(scene.mainButtoms.R)){ //I choose the buttom R to be the dash button, but could be anyone.
   sprite.setVelocityX(speed * 2);

}else if(Phaser.Input.Keyboard.UpDuration(scene.mainButtoms.R, 1000)){
    sprite.setVelocityX(speed); // or sprite.setVelocityX(0)


but, you have to control if the user is moving with another key, and it's change  the speed, the speed can't change until the dash is over. So you need to think how to manage that in each case.


Link to comment
Share on other sites


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...