# Question about Dashing

**URL:** https://forum.makecode.com/t/question-about-dashing/5940
**Category:** Help
**Created:** [February 3, 2021, 4:25pm UTC](https://forum.makecode.com/t/question-about-dashing/5940 "2021-02-03T16:25:45Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![FlintAsher](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/flintasher/32/2745_2.png) [@FlintAsher](https://forum.makecode.com/u/FlintAsher)
#### Post date: [February 3, 2021, 4:25pm UTC](https://forum.makecode.com/t/question-about-dashing/5940/1 "2021-02-03T16:25:45Z")

</div>

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:

> **[Pat The Hermit(UNFINISHED)](https://arcade.makecode.com/58180-19391-83824-66214)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

---

<div class="post-metadata">

### Author: ![UnsignedArduino](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/unsignedarduino/32/592_2.png) [@UnsignedArduino](https://forum.makecode.com/u/UnsignedArduino)
#### Post date: [February 3, 2021, 4:53pm UTC](https://forum.makecode.com/t/question-about-dashing/5940/2 "2021-02-03T16:53:11Z")

</div>

Would something like this work?

> **[Pat The Hermit (UNFINISHED) (Dashing)](https://arcade.makecode.com/14422-45614-22797-60836)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

---

<div class="post-metadata">

### Author: ![FlintAsher](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/flintasher/32/2745_2.png) [@FlintAsher](https://forum.makecode.com/u/FlintAsher)
#### Post date: [February 3, 2021, 5:03pm UTC](https://forum.makecode.com/t/question-about-dashing/5940/3 "2021-02-03T17:03:23Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Agent\_14](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/agent_14/32/17567_2.png) [@Agent\_14](https://forum.makecode.com/u/Agent_14)
#### Post date: [February 3, 2021, 5:36pm UTC](https://forum.makecode.com/t/question-about-dashing/5940/4 "2021-02-03T17:36:55Z")

</div>

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

---

<div class="post-metadata">

### Author: ![shakao](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/shakao/32/113_2.png) [@shakao](https://forum.makecode.com/u/shakao)
#### Post date: [February 3, 2021, 5:40pm UTC](https://forum.makecode.com/t/question-about-dashing/5940/5 "2021-02-03T17:40:59Z")

</div>

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

> **[dash](https://arcade.makecode.com/64675-08748-63239-29225)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

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.

---

<div class="post-metadata">

### Author: ![FlintAsher](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/flintasher/32/2745_2.png) [@FlintAsher](https://forum.makecode.com/u/FlintAsher)
#### Post date: [February 3, 2021, 5:47pm UTC](https://forum.makecode.com/t/question-about-dashing/5940/6 "2021-02-03T17:47:03Z")

</div>

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!

---

<div class="post-metadata">

### Author: ![UnsignedArduino](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/unsignedarduino/32/592_2.png) [@UnsignedArduino](https://forum.makecode.com/u/UnsignedArduino)
#### Post date: [February 3, 2021, 6:47pm UTC](https://forum.makecode.com/t/question-about-dashing/5940/7 "2021-02-03T18:47:32Z")

</div>

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

> [@FlintAsher](#):
>
> …then i tried to boost their velocity but it only worked if they were standing still and only in one direction.

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

---

<div class="post-metadata">

### Author: ![FlintAsher](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/flintasher/32/2745_2.png) [@FlintAsher](https://forum.makecode.com/u/FlintAsher)
#### Post date: [February 3, 2021, 7:05pm UTC](https://forum.makecode.com/t/question-about-dashing/5940/8 "2021-02-03T19:05:20Z")

</div>

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

> **[Pat The Hermit (UNFINISHED)](https://arcade.makecode.com/48572-79800-70535-24295)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

---

<div class="post-metadata">

### Author: ![shakao](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/shakao/32/113_2.png) [@shakao](https://forum.makecode.com/u/shakao)
#### Post date: [February 3, 2021, 7:12pm UTC](https://forum.makecode.com/t/question-about-dashing/5940/9 "2021-02-03T19:12:50Z")

</div>

Awesome, it feels really fluid in-game! 😃 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!

---

<div class="post-metadata">

### Author: ![FlintAsher](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/flintasher/32/2745_2.png) [@FlintAsher](https://forum.makecode.com/u/FlintAsher)
#### Post date: [February 3, 2021, 8:55pm UTC](https://forum.makecode.com/t/question-about-dashing/5940/10 "2021-02-03T20:55:15Z")

</div>

> **[Pat The Hermit (UNFINISHED)](https://arcade.makecode.com/96128-91894-46399-05773)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

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.
