When I have multiple sprites with the same name and I tell that name to stop following me the original stops but clone keeps following. why?
I am talking about Robot_2
@coolCoder thanks! i think there’s a misunderstanding here about how variables work.
variables can only point to one thing at a time. every time you create a new robot, the Robot_2 variable will be updated to point to the most recently created robot. that’s why you only see one sprite stopping when they get close.
if you want to have this behavior for all of your robot sprites, then you want to take advantage of sprite kinds. for example, take this bit of code from your project:
we can rewrite this using these two blocks:
array of sprites of kind ____
from the Sprites categoryfor value of ____
from the Loops category
like so:
notice how instead of using the Robot_2 variable, i’m using the value variable that is created by the for-of loop.
1 Like
Thank you this was my first time using the forum
2 Likes