Toggle something

For questions about using Classic.

Post » Wed Jun 23, 2010 5:00 pm

I want to toggle something, but i can't find how to do it in Construct.

I would like to execute this code in Construct:

[code:rk2ljp33] if (GetAsyncKeyState(VK_F1)&1) mVisible=(!mVisible);[/code:rk2ljp33]
B
1
G
2
Posts: 4
Reputation: 633

Post » Wed Jun 23, 2010 5:44 pm

Are you trying to use Python or Events?
B
8
S
3
G
7
Posts: 835
Reputation: 5,313

Post » Wed Jun 23, 2010 5:56 pm

no...
B
1
G
2
Posts: 4
Reputation: 633

Post » Wed Jun 23, 2010 6:46 pm

Easiest way would be:
variable = 1 - variable

With variable being either 0 or 1, it will always toggle (1 - 0 = 1, 1 - 1 = 0)
B
62
S
21
G
12
Posts: 1,910
Reputation: 13,155

Post » Wed Jun 23, 2010 6:48 pm

I think what you want is Mouse & Keyboard's Control State.
+ MouseKeyboard: On player 1 pressed "Control 1"
-> Do this

+ System: MouseKeyboard.ControlState("Control 1", 1)=1
-> Do this
Note you will have to define the key in preferences for F1.
Image Image
B
161
S
48
G
90
Posts: 7,356
Reputation: 66,767


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 2 guests