Add a 1d Array as a behavior for a Sprite?

0 favourites
  • 4 posts
From the Asset Store
ADD ME ALL
$29 USD
A super duper mental math activity to practice addition with unlimited combinations.
  • So let's say I want to add a Vector3 style 1d array to my sprite. Currently I would add three separate variables to it (X, Y, Z) and call it like this: Sprite.X, Sprite.Y, Sprite.Z. The variables list can get really really long.

    What does everyone think about being able to add a 1d array style behavior to a Sprite (such as [3]) ? For instance if you added a 1d array named 'myArr' with a length of 3 to your sprite, you would call it like Sprite.myArr[0], Sprite.myArr[1], Sprite.myArr[2].

    Opinions?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You can also bundle a sprite and an array together in a container, so each sprite instance will get its own personnal array.

    However, it'd much simpler and intuitive to be able to reference said array the way you pointed it.

  • I think what Magistross said is the way. The array in a container is picked automatically when you pick the sprite, and the reference is still the same amount of work at your example - but without complicating the sprite object.

    So by picking the sprite, you should just be able to check array.at(0), array.at(1), etc.

  • I've made a suggestion similar to this for an object type that could be used as a container.

    construct3.ideas.aha.io/ideas/C3-I-1824

    Its a little more complicated than a single vector.

    I'm not overly excited about using the Array object, but It would make it far more useful.

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