How do I search through array at y1 to get x

Get help using Construct 2

Post » Sat Jan 31, 2015 8:43 pm

I have a 2d array where each X represents a location. The y value for that x contains the name, location, and other game values. I am at a spot where I need to search through all the values at y1 so I can figure out which x it is on. I have not been able to figure out how to do this in the event sheet. Any assistance is really appreciated.
B
7
S
2
Posts: 10
Reputation: 495

Post » Sat Jan 31, 2015 8:52 pm

You use a for loop for this.

Look here at loops: https://www.scirra.com/manual/124/system-conditions

In the for loop you access your Array at x, which you iterate and y1 (fixed).
B
11
S
2
Posts: 213
Reputation: 1,266

Post » Sat Jan 31, 2015 9:04 pm

Chupup Games wrote:You use a for loop for this.

Look here at loops: https://www.scirra.com/manual/124/system-conditions

In the for loop you access your Array at x, which you iterate and y1 (fixed).


Yes, I have tried this, though I don't know how to keep y1 fixed.
I tried the following, and don't know how to only check values on y1.
2015-01-31_14h59_36.png
You do not have the required permissions to view the files attached to this post.
B
7
S
2
Posts: 10
Reputation: 495

Post » Sat Jan 31, 2015 9:11 pm

Use System.For
You do not have the required permissions to view the files attached to this post.
ImageImageImage
B
71
S
21
G
221
Posts: 3,649
Reputation: 124,227

Post » Sat Jan 31, 2015 9:15 pm

A FOR Loop is something different than a FOREACH Loop :)
B
11
S
2
Posts: 213
Reputation: 1,266

Post » Sat Jan 31, 2015 9:26 pm

blackhornet wrote:Use System.For


Yes, thank you that is much more how I think of iterating over arrays. Good to see how to do it in this paradigm. Working as expected now. I appreciate both of your time for responding to my question.
B
7
S
2
Posts: 10
Reputation: 495


Return to How do I....?

Who is online

Users browsing this forum: leandrogenske, R0J0hound, totoe, TylerJS and 9 guests