Arrays in arrays

  • 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)?

  • Reference UID of the creatures array in your items array.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Yes, that is quite efficient, thanks. So, as far as i see, there`s no way to put an array into array, yes?

  • Nope. Saving a reference to the array is much more efficient anyway. :)

  • Ok, i will keep going this way. Added 2 array "levels" deep today and it looks and acts pretty good. Thanks for you help.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)