Question about Dashing

Does anyone know how to make the player dash in the direction they are moving with effects when B button is pressed? I don’t just want to change the characters position for fear of them glitching through walls.

Here is the game i need it for:

1 Like

Would something like this work?


If feels nice, but unfortunately it’s kind of basically sprinting. The kind of dashing i’m trying to get is like the dash ability in Celeste or Pixel Quest (look them up if you need to). I’ve tried to boost the player with a jump in their acceleration but that was a bust, then i tried to boost their velocity but it only worked if they were standing still and only in one direction.

1 Like

Got a theory. Disable controls, set vy and any to 0, and then after like 1 sec reset to originals.

1 Like

Something like this? (Press ‘B’ to dash)

I’m saving the player’s previous direction, disabling controls and setting the velocity, then enabling controls and resetting velocity after a short interval. This only does horizontal, but you could change “movingLeft” to store 4 (or eight, if you want diagonals) different directions based on which buttons were last pressed.


Yeah this is exactly what i was going for, thank you so much!!! Now i know how to do it for the future whenever i make other games too!

1 Like

Ah, sorry, I didn’t really understand what you meant. :sweat_smile:

That’s because the move sprite with vx vy will overwrite any vx and vy set on them automatically.

I had to tinker with it a little bit to get the movement feel i wanted but it works perfectly.


Awesome, it feels really fluid in-game! :smiley: Two small issues I noticed in my example:

  1. Saving the vx before the dash and resetting it after might be a mistake, haha–I think this actually causes slightly weird behavior sometimes where you’re not pressing a button after the dash and the sprite keeps moving
  2. You might want to turn off gravity when the player is dashing also, if you want a perfectly horizontal dash… up to you which you think feels more natural!

I’m excited to see how the rest of the game turns out!


This is the game so far, you can dash, you can wall climb, and i’m thinking of maybe changing the jump button to the up arrow and using A(aka Z on cpu) to have the player sprint, i would be using Unsigned’s code idea for this.