How do I add sprites to arrays?

  • Okay, so I'm a little bit confused on this. I'm trying to set up a function where I search for each instance from an object and add that object to an array.... but how do I add the object itself? Each time I try to do so, it seems like I can only add variables from that object to the array array.

  • You can't add objects. You could add the UID, and "pick by UID" later when needed.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You cannot store objects in array. Arrays in C2 can only store numbers or strings.

    If i understand correctly, you will want to store object UIDs and use that as a reference to an object.

    Also, i suspect (but am probably totally wrong) that you can avoid storing UIDs in arrays and with events (more exactly conditions) pick a group of objects, and then apply some actions to them.

    I recommend reading how events work if you haven't read it, and of course look into Families and Containers for more advanced object picking.

    Hopefully i didn't miss your question.

    Also, i recommend getting used to manual, i do it almost daily.

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