Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Individual Variables For Each Clone?
- St19_Chuba
-
99 posts
Individual Variables For Each Clone?
As the title says, i need variables on clones to be seperate, kinda like directions.
I'm using velocity for a ricochet on a projectile, but it affects all clones ;-;
Say a clone changes it's x velocity by 1. Every clone then does the same, but i dont want that D:<
Any way to fix this? I would really appreciate it if someone told me
I'm using velocity for a ricochet on a projectile, but it affects all clones ;-;
Say a clone changes it's x velocity by 1. Every clone then does the same, but i dont want that D:<
Any way to fix this? I would really appreciate it if someone told me

- awesome-llama
-
1000+ posts
Individual Variables For Each Clone?
Use local variables. When it is cloned, the variable stays with the clone as an independent variable. This is useful to do many things like velocity or health.
- crisostimo
-
500+ posts
Individual Variables For Each Clone?
I have a well commented tutorial on cloning sprites that may help you:
https://scratch.mit.edu/projects/94046493/
https://scratch.mit.edu/projects/94046493/
- Studio42
-
500+ posts
Individual Variables For Each Clone?
“For this sprite only” variables also mean “For this clone only”
- footsocktoe
-
1000+ posts
Individual Variables For Each Clone?
As the title says, i need variables on clones to be seperate, kinda like directions.
I'm using velocity for a ricochet on a projectile, but it affects all clones ;-;
Say a clone changes it's x velocity by 1. Every clone then does the same, but i dont want that D:<
Any way to fix this? I would really appreciate it if someone told me
You have to use a clone ID system if you want individual clones to have different behaviors from other clones.
- deck26
-
1000+ posts
Individual Variables For Each Clone?
Not if you use local variables as described and each clone manages its own variable. Please don't post on old topics - if you need help create a new topic, describe the issue and. preferably, share the project. All cones have same health
- geramihasfood
-
100+ posts
Individual Variables For Each Clone?
You need to use local variables. To do that, when creating a variable you need to click As the title says, i need variables on clones to be seperate, kinda like directions.For this sprite only instead of the For all sprites. This sets it to a local variable, meaning a variable that only the sprite and its' clones can access it.
I'm using velocity for a ricochet on a projectile, but it affects all clones ;-;
Say a clone changes it's x velocity by 1. Every clone then does the same, but i dont want that D:<
Any way to fix this? I would really appreciate it if someone told me
That also means that clones can create a copy of that variable and so when you change the variable in the clone, it won't change the variables in other clones.
Edit: I didn't look at the date. ;-;
Last edited by geramihasfood (March 26, 2025 15:37:44)
- Discussion Forums
- » Help with Scripts
-
» Individual Variables For Each Clone?