How do I use UIDs and IIDs?

0 favourites
  • 7 posts
  • So I'm making a platform beat-em-up. I have a player, enemy, and spawner. Everything works but one thing, all enemies spawned act like the first one on screen. I've heard about UIDs and IIDs to fix this, but I have no clue how they work. Please dumb it down for a small-brained gamer like me.


  • ok so

    UID is the unique ID, every time an object is created, UID goes up by 1 and assigns that UID to the object, every single object type is part of the same UID group, UID for an object never changes, UID never gets recycled, which means once an UID has been used for an object, it will never be used ever again and it keeps incrementing.

    IID is unique to every object type, meaning every single object will be in a different IID group, sprite1 will have their own group of IID, sprite3 will be in a different group. IID changes, when an object is deleted, every object with an higher IID, their IID goes down by 1, when a new object is created, it becomes the object with the highest IID, meaning IID is ordered by creation, older objects have a smaller IID

    You usually use IID when you want to pick a specific object type in a loop or something, like, if you're looping through every object count in the "car" family or when there is a predetermined hardcoded amount of them.

    UID is fast and is for picking a specific object project wide like, you store a character's UID in their hat sprite so you can set the hat's X and y positions to the position of the character sprite picked by UID or soemthing something

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Oooooh, gotcha. Thanks for explaining. So now how do I make all my enemies act differently?

  • you have to understand picking

  • And how do I learn THAT

  • ask people about it, i think, or look at templates and try and make games and look at the documentation and struggle, it'S up to you.

  • Hi, you can look at some video's on my youtube channel.

    Plenty of real-world examples on how to do picking.

    hope that helps!

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