Eliminating Objects that have the same name

0 favourites
  • 4 posts
From the Asset Store
Welcome! I-Spy (Hidden objects) is an educational puzzle that is more than just seek-and-find activities.
  • In my game, I create a lot of objects (around 100) with randomly generated names composed from a list of strings. Is there a way to see if two objects have identical names, and then destroy them if they do?

  • If they are different objects, they cannot have the same name.

    If they are same objects (Create Object), then they ALL would have the same name.

    Distinguishing and corresponding to a specific object then would be through its UID (Unique ID) or "Picking by near/far" etc. feature.

    Otherwise, there is no 'expression' to compare "names" of Sprites, but there are ways around it.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Your best solution is not to use the same name in the first place - that is, when the name is used, remove it from the list.

    Here's one quick example, picking one extra index to show that all of the names were used (result is 0).

  • You could try picking them via

    If Object StringName == "Uniquename"

    random <value>

    if value > a 50% of that

    & Object StringName == "Uniquename"

    pick random instance


    Of course if you have 20 of these guys with the same name you'd have this run alot.

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