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:
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:
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.
Got a theory. Disable controls, set vy and any to 0, and then after like 1 sec reset to originals.
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!
Ah, sorry, I didn’t really understand what you meant.
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! Two small issues I noticed in my example:
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.