I don’t know if this is possible, but what I do is add a variable id to each object so then you know which object is in use.
For example
Create object Player at position 200;200
Do =1 to variable id of Player
Create object Player at position 200;200
Do =2 to variable id of Player
Create object Player at position 200;200
Do =3 to variable id of Player
Then you check for id value. That will do the trick
Try to understand:
on begin of screen
I create the object and popolate the object variable with 1 (first instance)
I create the second object and popolate the object variable with 2 (second instance)
I create the third object and and popolate the object variable with 3 (second instance)
In this case the first one is valued with one, the second with 2 and the third with 3?
Is it correct ? Why when I popolate the second time the variable the first instance is not affected ?
Hi,
The command create among allows to create an instance using string expressions.
If you have objects: obj0, obj1, obj2 and obj3, you can then use “Create “obj” + Random(3)” and it will create one of the obj objects.
yes you are right in all questions.
The variables are unique per instance, so the value es different per object.
So when you want to search an object do a repeat for all objects player
then check value of player variable id and do what you need
I don’t understand .
In create object I can insert the object name. In create among I can insert the object name and a string. But the object isn’t generated in my case.
Have I to called it “Player01” in case I wont to create an insance of Player ?
The command create among is NOT to choose a name for instances, it is used to create instances by calling objects using string expressions.
You cannot change the name of objects, but you can assign object variables to tell instances apart, as explained by @xisco.
I agree it’s not very clear, I had trouble with this as well, when I started.