How do I store NAME of objects to an array

0 favourites
  • 3 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • How do I: Store the NAME of objects onscreen to an array?

    I have 3 objects on screen (for now). They're all in the same family.

    How do I code a system that goes through the objects 1 by 1 and saves their NAME(s) to a 3 by 3 array, at position X=0 for each?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Objects don't have names that you can store, but you can give them a variable and assign it a value to whatever you want. EG: Objectname.

    Ideally you want to store the UID or (Unique identifier) which each object has. so that you can refer to that specifically later.

    to store it into an array like you wanted to do.

    (system) For each (object) -> (array) set at X = Loopindex, value = (object.UID)

    this will put the UID of each object into the X position of the array as it loops through each object in the scene

  • Thanks for the reply Justifun.

    I got quite far since posting my original question and I have the names of my objects stored in an array quite nicely.

    So, I have something like this:

    0,red,yellow,blue

    red,0,0,0

    yellow,0,0,0

    blue,0,0,0

    As you can see, it's basically a grid with names across the top and down the side.

    What I wanted to do next.... which I can't figure out, is cross reference the grid.

    I wanna be able to look along the X axis (Red) then down the Y axis (Yellow) and were the two meet up, set to orange! Then the same with X=Yellow, Y=Red....

    Then, later on, I want to be able to do the same thing with looking up where the X and Y meet and have it result in 'orange'. You get what I mean, I'm sure.

    Where the X=red and the Y=blue, that would be purple and so forth.

    I hope you can help as I'm quite stuck on this part.

    Cheers.

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