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
71
S
27
G
17
Posts: 254
Reputation: 14,946

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

Post » Fri Nov 16, 2012 7:23 pm

Nice Idea ! David !
B
36
S
16
G
16
Posts: 2,223
Reputation: 16,646

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
163
S
120
G
9732
Posts: 42
Reputation: 4,875,331

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
262
S
93
G
55
Posts: 7,156
Reputation: 67,081

Post » Fri Nov 16, 2012 9:03 pm

Thank you, I understand how it works now.
B
71
S
27
G
17
Posts: 254
Reputation: 14,946


Return to How do I....?

Who is online

Users browsing this forum: alajajm, jakeedge02, Kenthria, ling200916, MSNbot Media, Yahoo [Bot] and 8 guests