How to make double key pressed?

How to I press a key double times so I can make extra controls and mechanic?

3 Likes

Like on Minecraft where you tap W twice and it enables sprinting?

4 Likes

Yes that type of mechanic

2 Likes

You could make it so when you press a key, it will add +1 to a number and add a filter to the end of that. So when it equals 2, it will emit an output and have a third number behavior to set the 2 back to 0.

Also add a timer that starts when you press the key so after like .5 to 1 second (not sure what would work) it will reset it back to 0 as well.

That way when you press it down twice within one second, it will activate, but it won’t activate if you don’t press it twice within one second.
I think doing half a second might work a little better since you have to press a key twice pretty quickly while also having room to casually press the key without double clicking.

4 Likes

Ummmmm I wish I wasn’t new here so I knew what you talking about but my brain just explode so any examples???

2 Likes

Do you have a link to the game? I can try whipping up something and i can send you a screen shot.

1 Like

Also sorry that it wasn’t that clear. Flowlab behaviors aren’t exactly the greatest to explain with words, lol.

1 Like

Ok sorry for a little-late reply but here it is the link

1 Like

And one more thing can you do it to all keys @ManiacPumpkin

1 Like


Works for both 'Repeating" and not repeating. If you need any more help feel free to @ me, I’m always happy to help :llama:

4 Likes

So thats the code for double press???
@CodeAlpaca

3 Likes

Yes, if you press the button twice within whatever the time you want is, it will activate.

2 Likes

Ok so if I attach the do something number value and add it to y vecotiy would it double jump?@CodeAlpaca(sorry for the bother

1 Like

And what do I put in the other zero or do I leave it?
(now im really sorry)

1 Like

it would act as a double jump, yes. You are able to double jump again, but just add a switch to turn off when you double jump and back on when you’re on the ground.

2 Likes

The other zero just resets the system

2 Likes

So theres two switches???

1 Like

Just have something to turn that back on so you won’t be able to jump infinitely

2 Likes

Just wanted to throw my idea in, I believe something like this would work too.

1 Like

Doesn’t work for repeating keys. also not resetting it after it passes through would probably cause very slight problems in most games. (example where it would not be great clicking; shooting a fireball on double key press, but if you click 3 times fast, but then the timer kicks in, meaning you would need to click 5 times to shoot 2 fireballs)

1 Like