How do I use boolean

Just started using Construct 2? Post your questions here

Post » Tue Mar 04, 2014 3:24 pm

Hello
i need some help...

I'w set my boolean variable and now i see 2 choices in edit action options:
set boolean or toggle bolean.
Can someone explain to me difference and usage specifics?

Thank you!
B
26
S
11
G
2
Posts: 669
Reputation: 5,038

Post » Tue Mar 04, 2014 3:37 pm

Set boolean sets it to a specific value.

Toggle sets it to it's inverse value. For example, if it's True and you toggle, it will now be False. If False and you toggle, it will now be True.
Image Image
Scirra Founder
B
160
S
41
G
34
Posts: 4,386
Reputation: 53,514

Post » Tue Mar 04, 2014 3:46 pm

Set boolean set it between true or false one time. Toggle bolean change every time that the event happen.

An example of SET BOOLEAN is: the playerbox have a boolean called run, if i press "x" button, the boolean will be true and it belong true. You need another condition to change that. (you drive this)

the same example with toggle boolean: every time that you press "X" the boolean will change. if the boolean was in true, this will turn to false. Same to false. Every time that you press "x", the boolean will change.

Sorry for my english but isn't my native language
B
7
S
1
Posts: 3
Reputation: 911

Post » Tue Mar 04, 2014 3:58 pm

Thank you...
Its very helpfull!!!
B
26
S
11
G
2
Posts: 669
Reputation: 5,038


Return to Beginner's Questions

Who is online

Users browsing this forum: vslk and 2 guests