Multiple copies of an instance

I have multiple copies of the same instance “hand” that changes direction at the top and bottom of the screen at an angle the issue is when I have more than one copy of the instance they both move at the same direction and angle?

events


1 Like

FYI You have multiple copies of the same “object” hand, each of which is an “instance” of a hand object. (this is a bit pedantic, but I just thought you might want to use the correct CS terms)

This type of problem is due to the fact that if you don’t reference a specific instance in the condition of the event, then the action for that event will apply to all instances of the object that meet that condition.
So you need to add some sort of reference to the specific hand you want to take action on. Typically this is done by adding an instance variable like “id” to your hand object, and then setting the “id” variable to something unique each time you create one. Then add an additional condition like “Variable of hand ‘id’ = 1” to your existing conditions to ensure it only selects that specific hand for the actions.
You can also try surrounding all of your hand logic with a “For each hand object” block to ensure the logic is done for each instance and not using the ‘selection’ way.
I hope that helps.

2 Likes

Put all the events of the second screenshot in a Foreach hand

Like
Foreach hand objects
<----> Move
<----> Attack

2 Likes

solved thanks I added repeat for each instance but also I had to change the variable from a scene to an object that was the issue.

events

1 Like