Discuss Scratch

xkldnhatban
New Scratcher
3 posts

Mortal Kombat dashing

In Mortal Kombat (2011) and Mortal Kombat X, moving foward makes you walk a normal speed, while tapping the stick in that direction twice, you dash foward and cover about twice the distance. How can I replicate this in my fighting game using the right arrow key?

Thank you so much
axisjack
Scratcher
100+ posts

Mortal Kombat dashing

Ok i need to think tjis through

Last edited by axisjack (June 28, 2019 10:20:14)

imfh
Scratcher
1000+ posts

Mortal Kombat dashing

You should share the project and link so we can tell you a specific way to do it for your project.

One way you could do it though is like the below. This is probably an inefficient way to do it though by itself as it adds a new forever loop.

when green flag clicked
forever
set [presses v] to [0] // Holds how many presses there are
wait until <key [right arrow v] pressed?>
if <((timer) - (lastPress)) < [1]> then // Get the time since the last press
set [presses v] to (2)
else
set [presses v] to [1]
end
wait until <not <key [right arrow v] pressed?>>
set [lastPress v] to (timer) // Save the time of this press
end
codeman1044
Scratcher
1000+ posts

Mortal Kombat dashing

Just a side note on imfh's post.
The boolean that checks the difference between the timer and the lastPress variable probably shouldn't be compared to 1, as that would give an entire 1-second window to double tap the key. I would try somewhere between 0.2 and 0.5 seconds instead.
Just my opinion.

Powered by DjangoBB