I have an object that has the same name in the sprite list. I create multiple instances of this object during the game using the block, and I want to change the parameters of a specific instance, not all of them.
For example: I have 5 identical objects, and I want to increase the one that was clicked on.
How can I do this? This would help in many mechanics.
There is a condition called “The cursor is on Object”
This will pick all instances of the object, the cursor is hovering. For the click I would recommend the “Mouse Button has been released” condition. That way it only triggers once.
Generally speaking: If you want to specify specific instances, you should use variables. You could, for example, assign unique IDs to each Instance of the Object.
Conditions work like filters. They create picklists that contain the matching instance. Each object gets its own list. That list is used for any other condition which might further modify the list. The list can only be made smaller unless you reset the list with pick all instances. The current list is also passed to the other subevents, conditions, actions and expressions.
As long as there’s at least 1 matching object then the other conditions or actions will be processed. If there aren’t any matching objects then control moves to the previous subevent level or the next event.
You could start with 50 objects, the first condition could take it down to 20, another condition could take those 20 down to 5 or 1. There are some conditions that will only pick 1 object like the pick nearest object or pick a random object but most conditions have the potential to pick multiple objects.
When control moves back from one subevent, that previous list is used. When you start a new event
Objects can be picked with almost any condition with exceptions of conditions like compare 2 numbers which just compares the numbers. It doesn’t modify the picklist.
I’m not a fan of object IDs. They have their uses. Mostly when the number of objects doesn’t change like for an inventory or a keypad or maybe navigation nodes.
The most common ways to pick objects are through mouse events, collisions, checking a value or state of a variable, animation names, an objects position… There are a lot of conditions