Checking if no key is pressed

For questions about using Classic.

Post » Sun Jan 31, 2016 9:01 pm

Is there a way to check whether no key is being pressed? I want the game to check if the player isn't pressing any key at all. The regular keyboard and mouse object only includes a condition for any key being pressed. I tried using that and inverting the condition, but it doesn't seem to work. Does anyone how to do this?

Thanks.
B
4
S
1
Posts: 13
Reputation: 376

Post » Sat Feb 06, 2016 4:22 am

Unfortunately the "on any key pressed/released" are triggers, meaning they only happen once when first "triggered", so inverse of that is something that never happens at all.

It looks like you might have to check "is down" for each and every control to check for no keys down sadly :(
"Construct 4 lets YOU make advanced games! (but not play them)" Construct Classic - Examples Kit
B
107
S
38
G
17
Posts: 2,169
Reputation: 18,933

Post » Sat Feb 06, 2016 10:53 pm

you could use a global variable and a loop. something like:

every tick
--- set global 'anykeydown' to 0

for "" from 0 to 255
key loopindex is down?
--- set global 'anykeydown' to 1

global 'anykeydown' equal to 0
--- do stuff
B
88
S
30
G
89
Posts: 5,113
Reputation: 60,337


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 2 guests