Can I store all my objects X/Y into an array using "pick" ?

0 favourites
  • 5 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • Hi. I would like to store all my objects coordinates into an array . Does this work with a system -> pick all, or does this work only with a system -> foreach ?

    I tried this but it doesn't seem to work :

    I already have an array with all my elements coordinates and their corresponding array index number (stored in an object variable as chronobject.arrayIndex). I just want to use this new condition to update their coordinates into this array.

    Is it possible to do so like this? I tried with a foreach and it works perfectly, but I don't really want to use a foreach for some reasons.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • No, you have to use a loop.

  • Thank you.

  • Pick all means you are considering all instances, it is useful if you picked some instances but you want to have all picked once again (never happened to me to have to use it), pick all is automatic at the root of events, it does not imply that you will repeat for all instances treating each of them individually (actions will execute for all of them, but expressions will only use one reference instance).

    For each means you will apply what is next to all currently picked instances of that object individually, for each is implied in a lot of objects conditions (not all of them, on timer is an exemple that does not imply it), which means that expressions will be evaluated separately for each object.

    Right under your picking, I guess a for each is needed.

  • Thank you for your explanation.

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