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
63
S
23
G
17
Posts: 254
Reputation: 14,342

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
34
S
16
G
16
Posts: 2,222
Reputation: 16,564

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
157
S
114
G
8126
Posts: 42
Reputation: 4,071,739

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
247
S
85
G
40
Posts: 6,998
Reputation: 57,791

Post » Fri Nov 16, 2012 9:03 pm

Thank you, I understand how it works now.
B
63
S
23
G
17
Posts: 254
Reputation: 14,342


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 3 guests