How to compress the events into one?

Get help using Construct 2

Post » Thu Jan 24, 2013 12:12 pm

Hi all,

I'm making the levels, a global variable is added by one unlocks each level.




I'm wondering how to compress these events into one, is possible?
B
96
S
25
G
20
Posts: 3,055
Reputation: 22,644

Post » Thu Jan 24, 2013 12:21 pm

You can use the logical OR operator.

world_GoodLevels = 1 | world_GoodLevels = 2 | world_GoodLevels = 3 | world_GoodLevels = 4 | world_GoodLevels = 5 | world_GoodLevels = 6
=
1
Moderator
B
72
S
13
G
11
Posts: 900
Reputation: 11,783

Post » Thu Jan 24, 2013 12:37 pm

[QUOTE=thehen] You can use the logical OR operator.

world_GoodLevels = 1 | world_GoodLevels = 2 | world_GoodLevels = 3 | world_GoodLevels = 4 | world_GoodLevels = 5 | world_GoodLevels = 6
=
1[/QUOTE]

@thehen

It seems working



It makes me wonder it looks illogical to me when these OR operators are equal to 1 or was it luck?
B
96
S
25
G
20
Posts: 3,055
Reputation: 22,644

Post » Thu Jan 24, 2013 12:44 pm

It's saying that if any of those OR statements are true, then it returns true. 1 is true, 0 is false. Hence the comparison.
Moderator
B
72
S
13
G
11
Posts: 900
Reputation: 11,783

Post » Thu Jan 24, 2013 12:46 pm

@thehen interesing, thanks!
B
96
S
25
G
20
Posts: 3,055
Reputation: 22,644

Post » Thu Jan 24, 2013 2:38 pm

Interesting thx!
B
20
S
5
G
8
Posts: 325
Reputation: 6,473

Post » Thu Jan 24, 2013 2:43 pm

Very interesting! All the little things that get overlooked seem to be the most powerful ;) Thanks for sharing!
Image Image Image
B
60
S
19
G
5
Posts: 325
Reputation: 7,369

Post » Thu Jan 24, 2013 3:40 pm

You could also use >=1 AND <=6 in this case.
ImageImageImage
B
67
S
19
G
124
Posts: 3,215
Reputation: 74,417


Return to How do I....?

Who is online

Users browsing this forum: Kagubro, Yahoo [Bot] and 25 guests