How can I check if a whole array width is 1?

Get help using Construct 2

Post » Fri Nov 16, 2012 6:57 pm

Hello. Using an array, what conditions should I use to check if all the values of the width are equal to 1?

For instance, I have an array of Width: 5, and I need a condition that does something when all the 5 cells of the width contain the value 1.

Another way it could work is if there was a way of adding up the values, so if all the values in the X of the array equal 5, then do something. That would also work for me. I would prefer this way actually. Thanks.
B
66
S
24
G
17
Posts: 254
Reputation: 14,517

Post » Fri Nov 16, 2012 7:02 pm

You could try Array.Contains value and invert the event.
So it could read as "if the Array does not contain 0"
Could something like that work?
B
12
S
4
G
2
Posts: 59
Reputation: 3,739

Post » Fri Nov 16, 2012 7:23 pm

Nice Idea ! David !
B
35
S
16
G
16
Posts: 2,223
Reputation: 16,591

Post » Fri Nov 16, 2012 7:47 pm

If you really need the sum of the array values, here's an example:

http://dl.dropbox.com/u/33370253/SumArray.capx
B
160
S
117
G
9269
Posts: 42
Reputation: 4,643,529

Post » Fri Nov 16, 2012 7:49 pm

New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
253
S
86
G
42
Posts: 7,037
Reputation: 59,189

Post » Fri Nov 16, 2012 9:03 pm

Thank you, I understand how it works now.
B
66
S
24
G
17
Posts: 254
Reputation: 14,517


Return to How do I....?

Who is online

Users browsing this forum: Magistross and 0 guests