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! (they wont run anywhere)" Construct Classic - Examples Kit Dropbox is a pile of trash and if you need my old files PM me! :)
B
125
S
42
G
17
Posts: 2,229
Reputation: 19,920

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
94
S
33
G
114
Posts: 5,359
Reputation: 73,779


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 1 guest