Array problem (RTS mechanic)

0 favourites
  • 4 posts
From the Asset Store
Supports 1D, 2D, 3D arrays. Import and export arrays in JSON format
  • I'm trying to make an object "store" other objects, for which I'm using an array.

    So far it works, objects come in and out. But I have a couple problems with it =/

        1st, I wanna store a 2nd value with each object (in this case HP) and i don't know how to set or call for the Y of the X the stored objects are using. Maybe i'm doing it all wrong.

    The way I made it, is that each objects uses the "push front" action. maybe I need to check for unused spots or something D:

        And 2nd; for some reason that's making me wanna kill myself; when the 4 stored objects are the same type, it just doesn't work =(

    My CAPX

  • arrays are hard -_-

    still can't solve this

  • trying to use the push/pull method on a multi-dimensioned array will not work unless each dimension is unrelated to the others.

    Also, why it does not work with 4 objects...you destroyed each object as it collided with black, and after 4 were destroyed, there were no more instances available to create from. To fix, I added 1 Red and 1 Blue outside the viewport.

    Here is your better way:

    dropbox.com/s/go1hklpb4hi8u2y/array%20container%20ver2.capx

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Yey, thanks Kosiam!

    Your way of doing it is pretty much what I imagined it should look like :D

    It was really clever to use the variable for locating the X's.

    With that I was able to set and use a Y value as well ^^

    About the problem when all 4 are the same... I've done a ton of capx where even when there is no instance left; I can Create a new one. Heck, my main project does this without any trouble -_-

    There must be something else causing this problem. (Although having +1 around does solve it D: i'm confused xD)

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