How do I disable keys on a keyboard

Get help using Construct 2

Post » Sun Oct 26, 2014 3:07 am

is there any way I can disable a key on the keyboard.

when player collides with crate: Spacebar set disabled
wait 1.0 sec
set enabled
B
8
S
3
G
2
Posts: 52
Reputation: 1,762

Post » Sun Oct 26, 2014 3:36 am

I assume you are doing this so the player can't activate something the spacebar does...

Two ways,

Option 1:

Have the collision set a variable that is in the condition for the spacebar press.. ie. on-collision StopSpace=1.. in conditions for spacebar event add StopSpace=0:

On spacebar press - Action Do awesome thing.
StopSpace=0

Your collision event should be set to change it back to 0 after the 1.0 second wait. This way your not disabling the spacebar itself, just the events it activates.

Option 2: Put the spacebar event inside its own group and then have your collsion set this group "deactivate" for 1.0 second then "activate" again.
Check out my completed games on the Arcade! Capt. Doe Save the Universe! & Clicker Wizard!
B
66
S
17
G
8
Posts: 637
Reputation: 9,370


Return to How do I....?

Who is online

Users browsing this forum: NN81, ultrafop and 31 guests