Discuss Scratch

SussyCowHead
Scratcher
17 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?

whenIstartasaclonepointtowardsa sprite
scratcherman203040
Scratcher
7 posts

how do I make tag in scratch with clones?

I wish I could help
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:
sqrtofx1-x2*x1-x2+y1-y2*y1-y2
You will also need this block to point towards the nearest calculated position, you can find it at the end of this wiki page:
pointtowardsx:y:
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
17 posts

how do I make tag in scratch with clones?

0to9 wrote:

whenIstartasaclonepointtowardsa sprite
uhh, can't use “point towards” block, im using clones, it will point towards the original sprite.
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!

whenclickedgotox:0y:0pointindirection90setrotationstyleAll aroundforeverwait1secspointindirectionpickrandom-360to360setclone dirtodirection


whenIstartasaclonesetrotationstyleAll aroundpointindirection-90foreverrepeat10wait1secspointindirectionpickrandom-360to360pointindirectionclonedirgotorandom position
scratcherman203040
Scratcher
7 posts

how do I make tag in scratch with clones?

Actually this just mimics the turning thing sorry!
Penthusiast
Scratcher
28 posts

how do I make tag in scratch with clones?

SussyCowHead wrote:

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.

sqrtofx2-x1*x2-x1+y2-y1*y2-y1

Then just check the distance


sqrtofx2-x1*x2-x1+y2-y1*y2-y1<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.

Powered by DjangoBB