Arrays in arrays

Get help using Construct 2

Post » Sat Oct 12, 2013 8:26 pm

Hi.

I`m creating a tile-based RTS on arrays (kind of Dwarf Fortress on C2 :) ). I`m a newbie at arrays, but no matter because i`m going to raise my skill.

I`ve got a big array which is the "tiles" with sprites (graphic tiles) on it. Each tile (sprite) is a container with another type of an array - a "pile" of anything on that tile (grass, raindrops, elves, dorfs). Elves and dorfs must be arrays too, so i can store them like "body, clothes, armor, weapon and shield, enemy`s blood on the face"

So, the logic is: tiles (array) -> tiles (sprites) -> items on tile (array) -> creatures (arrays).

And the question is: how to put an array (creature) into the array (items)?
B
8
S
2
Posts: 56
Reputation: 1,021

Post » Sat Oct 12, 2013 9:03 pm

Reference UID of the creatures array in your items array.
B
24
S
9
G
7
Posts: 756
Reputation: 7,312

Post » Sun Oct 13, 2013 2:09 pm

Yes, that is quite efficient, thanks. So, as far as i see, there`s no way to put an array into array, yes?
B
8
S
2
Posts: 56
Reputation: 1,021

Post » Sun Oct 13, 2013 3:43 pm

Nope. Saving a reference to the array is much more efficient anyway. :)
B
24
S
9
G
7
Posts: 756
Reputation: 7,312

Post » Sun Oct 13, 2013 3:53 pm

Ok, i will keep going this way. Added 2 array "levels" deep today and it looks and acts pretty good. Thanks for you help.
B
8
S
2
Posts: 56
Reputation: 1,021


Return to How do I....?

Who is online

Users browsing this forum: Yahoo [Bot] and 29 guests