# Don't quite understand the Array object...

This forum is currently in read-only mode.
0 favourites
• 4 posts
From the Asset Store
This is a single chapter from the "Construct Starter Kit Collection". It is the Student Workbook for its Workshop.
• I figured out that for some reason, you can't set values at 0 indexes. So I began using the X index of 1 to store which save file would be accessed. At this index, 1 = save file 1, 2 = save file 2, etc.

And I thought I could use the Y index as a "subfolder" of sorts, since you can store values at X, Y. I was going to make the first Y index store Health, for example. So 1, 1 would store save file 1's health. 2, 1 would store save file 2's health. 3, 1, you get it...

But apparently, for some reason, I couldn't use the value of 1 for the index of Y. For some reason, it treated y1 as x1. When I tried to store the variable of Health in x1, y1, it ended up being stored in x1 alone. So it had to be put in 1, 2. I couldn't use the index of 1 for the Y coordinate for some reason. Is it supposed to be like that?

• ## Try Construct 3

Develop games in your browser. Powerful, performant & highly capable.

Construct 3 users don't see these ads
• Yes, x1 and y1 are the same. Think of a grid:

<font face="Courier New, Courier, mono">

Y

|

v

X->   1 2 3

1 . . .

2 . . .

3 . . .

</font>

Y coordinates going down, X going across.

That top left "." is 1,1. To use Y as a subfolder for X, you would need to start at 2 for the Y.

Eg.

1,1 = Name (N)

1,2 = Health (H)

1,3 = Speed (S)

This is what it would look like:

<font face="Courier New, Courier, mono">

• 1 2 3

1 N . .

2 H . .

3 S . .

</font>

Hope that helps.

<font size="2">(Edit: formatting)</font>

• So if you use, "Set value at X", it's being set at xX, y1? y1 will always be used in "Set value at X"? Like just a bunch of boxes? Hm... I imagined it working totally differently. I guess I'll stick with Array for save files then.

• I believe so. "Set value at X" is a 1 dimensional array command - the system will treat it as such and use only the first row.

A one dimensional array would of course simply be:

X: 1 2 3 4 5 ...

with no Y existing.