Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » how do I make tag in scratch with clones?
- SussyCowHead
-
Scratcher
21 posts
how do I make tag in scratch with clones?
I'm trying to create something based on Squid Games, it's called Scratch Games. The first game will be tag, the clone whom is it should point at the nearest clone/sprite. I need help 



































Last edited by SussyCowHead (March 11, 2025 17:13:31)
- 0to9
-
Scratcher
22 posts
how do I make tag in scratch with clones?
when I start as a clone::cat
point towards [a sprite v]
- EpicGhoul993
-
Scratcher
1000+ posts
how do I make tag in scratch with clones?
Store all the clone positions in a list, and make another list for distance towards each clone. (If you need to do this for every clone, this distance list needs to be set to “for this sprite only”.)
You will need to assign each clone its ID, and basically loop through every ID (skip the calculating clone's own ID of course) to find which one to point to.
The formula of distance between two positions is as follows:
You will need to assign each clone its ID, and basically loop through every ID (skip the calculating clone's own ID of course) to find which one to point to.
The formula of distance between two positions is as follows:
([sqrt v] of ((((x1) - (x2)) * ((x1) - (x2))) + (((y1) - (y2)) * ((y1) - (y2))))::operators)You will also need this block to point towards the nearest calculated position, you can find it at the end of this wiki page:
point towards x:() y:() ::custom
- deck26
-
Scratcher
1000+ posts
how do I make tag in scratch with clones?
If you search for ‘nearest clone’ you'll find various solutions to this.
- SussyCowHead
-
Scratcher
21 posts
how do I make tag in scratch with clones?
uhh, can't use “point towards” block, im using clones, it will point towards the original sprite.when I start as a clone::cat
point towards [a sprite v]
- scratcherman203040
-
Scratcher
7 posts
how do I make tag in scratch with clones?
I´ll keep you updated if i find away!!
- scratcherman203040
-
Scratcher
7 posts
how do I make tag in scratch with clones?
I found away to do it in a test way so do it in a different project first but the first two times it works its still progress and make a variable called clonedir fot this sprite only dont forget that so the code is below!
when green flag clicked
go to x: (0) y: (0)
point in direction (90)
set rotation style [All around]
forever
wait (1) secs
point in direction (pick random (-360) to (360))
set [clone dir] to (direction)
end
when I start as a clone
set rotation style [All around]
point in direction (-90)
forever
repeat (10)
wait (1) secs
point in direction (pick random (-360) to (360))
point in direction (clonedir)
go to [random position]
end
end
- scratcherman203040
-
Scratcher
7 posts
how do I make tag in scratch with clones?
Actually this just mimics the turning thing sorry!



- Penthusiast
-
Scratcher
56 posts
how do I make tag in scratch with clones?
I'm trying to create something based on Squid Games, it's called Scratch Games. The first game will be tag, the clone whom is it should point at the nearest clone/sprite. I need help
Check the distance from each clone to the point with the distance formula. Given the distance between two points is equal to the square root of x2 - x1 squared, plus y2-y1 squared (Basically constructing a triangle and finding the hypotenuse using the Pythagorean theorem), it would look something like this in scratch code.
([sqrt v] of ((((x2) - (x1)) * ((x2) - (x1))) + (((y2) - (y1)) * ((y2) - (y1))))::operators)
Then just check the distance

<([sqrt v] of ((((x2) - (x1)) * ((x2) - (x1))) + (((y2) - (y1)) * ((y2) - (y1))))::operators) < [some distance]>
This is what the distance block in scratch does - just that block only works to other sprites. This works for any two positions.
- Discussion Forums
- » Help with Scripts
-
» how do I make tag in scratch with clones?