Rererring to particular instances of an object

Say I have multiple instances of an object on a scene. How would I refer to particular ones if I, for example, wanted to create objects on top of some of them?

The instances in question are created with events.

You can use object linking and object variables to reference specific instances.
What I normally do is at the time I create an instance I also create an object variable called ID to assign a value to it and then check the value of the variable to pick a specific instance.

At the beginning of the scene : Do = 0 to Variable Counter

And then whenever you create an instance:

Create object objectName at position X;Y Do = Variable(Counter) to object variable ID of objectName Do +1 to Variable Counter

And then to pick an instance:

Variable ID of objectName is = 2 : Do something to that instance
1 Like

Depends how you want to choose the instance to refer to.

For example, if you wanted to pick one by its x/y position, you could add an event where the condition was ‘if x/y position is within an object’ (or something like that, can’t remember the exact name), and then referring to that object in the actions will refer to that specific instance.

Or if you want to refer to an instance when an object collides with it, then use one of the collision conditions.

Basically whichever instances of an object are true for a condition, those instances will be affected by those actions. Hope that makes sense…


Thank you both!