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

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.

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.


  • Recently Browsing   0 members

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