Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » How to assign numbers or names clones
- joe1718
-
Scratcher
64 posts
How to assign numbers or names clones
I don't remember exactly how to assign numbers to clones. Can someone tell me? And if there is a way, can someone help me delete clones and assign a previous number that already went (e.g. clone number 2 went off screen and got deleted, and assign the next clone number 1)?
- joe1718
-
Scratcher
64 posts
How to assign numbers or names clones
And if this is a repetition of some other forum, I'm sorry, but please send the link to the other one.
- EpicGhoul993
-
Scratcher
1000+ posts
How to assign numbers or names clones
Use a “for this sprite only” variable. This way every clone will have their own value, which is the value the original sprite get when creating the clones.
when green flag clicked
set [am I a clone v] to [0] // "for this sprite only"
set [clone ID v] to [0] // "for this sprite only"
. . . {
change [clone ID v] by [1]
create clone of [myself v]
} ::#aaa loop
when I start as a clone
set [am I a clone v] to [1]
- joe1718
-
Scratcher
64 posts
How to assign numbers or names clones
Can someone clarify what does the I am a clone variable do?
- geramihasfood
-
Scratcher
100+ posts
How to assign numbers or names clones
Can someone clarify what does the I am a clone variable do?you need to set it to a local variable, meaning when creating a variable for clones to use, you need to click the for this sprite only. With that, when you create a clone and set the variable for it, the clone has a copy of the variable.
for example I created a variable called clone number (doesn't need to be named this way). if it is a local variable (meaning for this sprite only) clones of the sprite can use it, while other sprites can't. if it's a global variable (meaning for all sprites) the clones can't use it, however other sprites can.
the am I a clone variable is useful for identifying whether a clone or a sprite should execute a message. I'm assuming 0 means false and 1 means true. like in this example:
when I receive [message for sprites only v]
if <(am I a clone?) = [0]> then
move (10) steps
end
in this case if the am I a clone variable is a 1 (meaning that they're a clone) the code above won't execute but if the am I a clone variable is a 0 (meaning that they're not a clone) the code above will execute.
I hope this helped

- joe1718
-
Scratcher
64 posts
How to assign numbers or names clones
But I need to figure out if a clone of a sprite (any clone) is below y -200.
This is what I have so far:
Thanks for all the help so far.
This is what I have so far:
when I start as a cloneI might be wrong, but I don't know if I am.
forever
if <(am I a clone?)> [-200]> then
end
end
Thanks for all the help so far.
- geramihasfood
-
Scratcher
100+ posts
How to assign numbers or names clones
But I need to figure out if a clone of a sprite (any clone) is below y -200.yeah, no, that seems pretty wrong. you only need to check the clone's position.
This is what I have so far:when I start as a cloneI might be wrong, but I don't know if I am.
forever
if <(am I a clone?)> [-200]> then
end
end
Thanks for all the help so far.
here's the updated script:
when I start as a clone
forever
if <(y position) > [-200]> then
end
end
The thing is that clone's have their own copies of the properties that the sprite has. so changing a y position in a clone will only change the clone's y position and not the sprite's y position.
Last edited by geramihasfood (March 26, 2025 01:22:42)
- joe1718
-
Scratcher
64 posts
How to assign numbers or names clones
Thank you very very much.But I need to figure out if a clone of a sprite (any clone) is below y -200.yeah, no, that seems pretty wrong. you only need to check the clone's position.
This is what I have so far:when I start as a cloneI might be wrong, but I don't know if I am.
forever
if <(am I a clone?)> [-200]> then
end
end
Thanks for all the help so far.
here's the updated script:when I start as a clone
forever
if <(y position) > [-200]> then
end
end
The thing is that clone's have their own copies of the properties that the sprite has. so changing a y position in a clone will only change the clone's y position and not the sprite's y position.
- Discussion Forums
- » Help with Scripts
-
» How to assign numbers or names clones


