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
105
S
29
G
28
Posts: 3,102
Reputation: 27,380

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,810

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
105
S
29
G
28
Posts: 3,102
Reputation: 27,380

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,810

Post » Thu Jan 24, 2013 12:46 pm

@thehen interesing, thanks!
B
105
S
29
G
28
Posts: 3,102
Reputation: 27,380

Post » Thu Jan 24, 2013 2:38 pm

Interesting thx!
B
21
S
6
G
8
Posts: 327
Reputation: 6,602

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
6
Posts: 325
Reputation: 7,908

Post » Thu Jan 24, 2013 3:40 pm

You could also use >=1 AND <=6 in this case.
ImageImageImage
B
70
S
19
G
156
Posts: 3,392
Reputation: 90,895


Return to How do I....?

Who is online

Users browsing this forum: 99Instances2Go, roxinhojp and 1 guest