How do I double tap keys to dash?

Just started using Construct 2? Post your questions here

Post » Mon Sep 14, 2015 12:08 am

Hello, I'm messing around with making a small platformer game, and I'm having trouble getting a dash to work. I want it so that when you start moving, you can quickly tap again at any time to start dashing, similar to how it works in something like Kirby. I figure some timer or variables are involved, but I'm still very new and am having trouble figuring it all out.

I'd appreciate any help, thanks!
B
3
Posts: 3
Reputation: 181

Post » Mon Sep 14, 2015 8:09 am

You can use the touch plugin
------------------------------------------------------------
global number speed = 25

condition: on double-tap gesture on (object_name)

action: set global variable (i.e., speed) to 100 or Add 25 to global variable (i.e., speed)
Wait 3.0s
set global variable (i.e., speed) to its initial value or subtract 25 to global variable (i.e., speed)

you can try different combinations =)
B
12
S
1
Posts: 63
Reputation: 633

Post » Mon Sep 14, 2015 8:13 am

A possible solution:

Create a valiable named, for example: dashHelper

if dashHelper > 0 -> Set dashHelper to Max(dashHelper - dt, 0)

if player moves (or just check for left/right movement)
and dashHelepr == 0
-> set dashHelper to 1 (or something smaller, bigger, try it out how you want it)

if player moves (or just check for left/right movement)
if dashHelper > 0
-> make the player dash


Hope it helps
B
10
S
2
G
1
Posts: 51
Reputation: 761


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 2 guests