it is so hard to select the object instance that I want to manipulate, as the getObjects(objectName) returns all the objects with that name. Why not like HTML’s id attribution, give a field, say uid, for users to fill a unique name/id, with which they can select the exact object.
This may need a unique name/id field in the property panel of the object and a condition like selectObjectByUid(uid). This would make it much easier to find the exact instance, when finding, for example, the target instance to indicate a specific answer in a puzzle set, so that I don’t have to create several target objects, which are just basically the same.
This would help when you are creating a game with character selection with two or more actual players (i.e. fighting game). Right now I have to limit my game to where you cannot select the same character because the commands would move both characters.
Same question, can’t you use a variable specific to each instance? You create two player objects, and each instance can have an id “1”, “2”, etc…
You could also prefer having two separate objects and use a group to apply the same events to them - depends on your use case. (you can even mix both approaches)
Its not working for me I’m not sure why. The only work around I have is to duplicate each character and make one designated for player 1 in group Player 1 and the copy in group Player Two
This issue came to me during designing a matching game for kids. The game shows 10 objects and 10 targets for the players to match. Well, I can do it with separated objects but it is a lot of redundant work. In this case, I did use JS to reduce the code.
I think I can share the part of JS that selects the object with certain variable through an extension with a condition when I get some spare time.
That’s goes inside a loop a For each object event. This is a special event that you can add by pressing the + icon.
So the event loop through every single instance one by one and assign the value of the scene variable called “counter” to an object variable called ID.
Then increase the value of the counter variable by 1.
Then, the loop moves on to the next instance and repeat this for every single instance one by one.
Because each time the loop runs you increase the value of the counter variable by 1, you get a different ID value for each instance.
So then you can say If variable ID of object is = 2 then do something to that specific instance only.
You need a text object let’s say it is called DEBUG.
Then the events going to looks like this:
`Condition: Cursor/touch is on Object Action: Change the text of DEBUG: set to: ToString(Object.Variable(ID))
thanx that worked😀, i want to create a tower defence game where u can upgrade your cannons, I THINK… and i have to upgrade a specific cannon or something like that