How do i make this condition...

Get help using Construct 2

Post » Mon Sep 02, 2013 12:07 am

I would to make a condition with if none key is pressed on gamepad, an action happen.

How do i make this?
B
9
S
1
Posts: 75
Reputation: 1,118

Post » Mon Sep 02, 2013 12:14 am

the gamepad has a "if any button pressed" condition, then just invert it =P
B
43
S
12
G
6
Posts: 446
Reputation: 6,802

Post » Mon Sep 02, 2013 1:13 am

Can't invert this.
B
9
S
1
Posts: 75
Reputation: 1,118

Post » Mon Sep 02, 2013 1:18 am

you can add all the buttons to an event and invert them all :P
B
92
S
31
G
24
Posts: 3,191
Reputation: 32,679

Post » Mon Sep 02, 2013 1:19 am

I don't understand. 'If no key is pressed' is just every default event. They occur every tick without a key being pressed.
B
46
S
16
G
74
Posts: 2,089
Reputation: 44,187

Post » Mon Sep 02, 2013 2:29 am

@plinie that wouldn't work, the default event overrides the trigger.

@sqiddster after a brief testing period, i agree with your idea. seems to be the only way to achieve this. hopefully he doesn't need many buttons xDSargas2013-09-02 03:05:22
B
43
S
12
G
6
Posts: 446
Reputation: 6,802

Post » Mon Sep 02, 2013 3:09 am

You could add to a variable if any button is pressed, and subtract from the variable if any button is released. If the variable is equal to 0 then there aren't any buttons being pressed.
B
46
S
14
G
7
Posts: 603
Reputation: 8,106

Post » Mon Sep 02, 2013 6:03 am

'is any key pressed' is a trigger and so it makes sense that you can't invert that

however, you would be able to invert 'is any key down'...

..if it existed.

Not sure why it doesn't.

anyway, just to expand on @EncryptedCows method

if the variable is local and non static

+var = 0
+on any key pressed > set var = 1

then you don't need to keep adding or subtracting cos the var gets reset to 0 every tick anyway
B
28
S
8
G
1
Posts: 469
Reputation: 4,683

Post » Mon Sep 02, 2013 6:03 am

What about using "If any button pressed" and then an "Else" after?
:O
B
4
Posts: 8
Reputation: 354

Post » Mon Sep 02, 2013 6:04 am

@faamorim
can't add an else after a trigger
B
28
S
8
G
1
Posts: 469
Reputation: 4,683

Next

Return to How do I....?

Who is online

Users browsing this forum: brunopalermo, tarek2, Unconnected, Waltuo, Yahoo [Bot] and 17 guests