Panst Posted January 4, 2019 Share Posted January 4, 2019 i´m new in Phaser 3. and my question is, How i can programming the dash ability for my character? Link to comment Share on other sites More sharing options...
kailcor Posted January 19, 2019 Share Posted January 19, 2019 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). Example: //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 More sharing options...
Recommended Posts