Discuss Scratch

fredlovessnails
Scratcher
16 posts

HOW DO I MAKE CLONES FOLLOW THE CLOSEST CLONE OF A DIFFERENT SPRITE!!!!????

I want to find out how to make a clone of lets say sprite 1 follow another clone of lets say sprite two
e.g:

:0 these are both clones
:0 will move towards
:0
:0
:0



PLS
BionicBoy554
Scratcher
1000+ posts

HOW DO I MAKE CLONES FOLLOW THE CLOSEST CLONE OF A DIFFERENT SPRITE!!!!????

You gotta put their positions in a list so the clone can follow it.
Cool_Dude2022
Scratcher
500+ posts

HOW DO I MAKE CLONES FOLLOW THE CLOSEST CLONE OF A DIFFERENT SPRITE!!!!????

fredlovessnails wrote:

I want to find out how to make a clone of lets say sprite 1 follow another clone of lets say sprite two
e.g:

:0 these are both clones
:0 will move towards
:0
:0
:0



PLS
This should help; it's a project made by me.
https://scratch.mit.edu/projects/964418154/editor/
Duroc694
Scratcher
100+ posts

HOW DO I MAKE CLONES FOLLOW THE CLOSEST CLONE OF A DIFFERENT SPRITE!!!!????

you would add each clone's X and Y cords to a list. Then use the distance formula to grab the distance of each clone. then save the X, and Y of the closest clone. and have the clones move to saved X and Y

Distance formula:
d = sqaure root of{(x2 - x1)^2 + (y2-y1)^2}
([sqr v] of ((((X2) - (X1)) * ((X2) + (X1))) + (((Y2) - (Y1)) * ((Y2) - (Y1))))::operators)
10goto10
Scratcher
1000+ posts

HOW DO I MAKE CLONES FOLLOW THE CLOSEST CLONE OF A DIFFERENT SPRITE!!!!????

You have a pretty common need. It’s number 10 in my studio of Scratch programming pitfalls (clones can’t be used in the motion or sensing blocks).

Cool_Dude2022 has a good solution except you said a clone of sprite 1 and clones of sprite 2.

Duroc694 gives the basics but there is “microcode” needed to manage clone ID’s and the constantly updated list items (not hard but not shown) but perhaps you don’t need help with that.

Other people have posted the full solution in previous posts, which, sorry, I have never added to my case study (it’s just a broken case study).

I think we need you to tell us if you have enough to go on with your project or if you have more questions.






Last edited by 10goto10 (March 26, 2025 00:11:08)

fredlovessnails
Scratcher
16 posts

HOW DO I MAKE CLONES FOLLOW THE CLOSEST CLONE OF A DIFFERENT SPRITE!!!!????

Duroc694 wrote:

you would add each clone's X and Y cords to a list. Then use the distance formula to grab the distance of each clone. then save the X, and Y of the closest clone. and have the clones move to saved X and Y

Distance formula:
d = sqaure root of{(x2 - x1)^2 + (y2-y1)^2}
([sqr v] of ((((X2) - (X1)) * ((X2) + (X1))) + (((Y2) - (Y1)) * ((Y2) - (Y1))))::operators)



this is from frelovessnails, thank you for this but i dont understand the written version, i need it to be tabbed
fredlovessnails
Scratcher
16 posts

HOW DO I MAKE CLONES FOLLOW THE CLOSEST CLONE OF A DIFFERENT SPRITE!!!!????

Cool_Dude2022 wrote:

fredlovessnails wrote:

I want to find out how to make a clone of lets say sprite 1 follow another clone of lets say sprite two
e.g:

:0 these are both clones
:0 will move towards
:0
:0
:0



PLS
This should help; it's a project made by me.
https://scratch.mit.edu/projects/964418154/editor/


from fredlovessnails, i need both sprites to be clones, your example cointains a sprite And a clone
Cool_Dude2022
Scratcher
500+ posts

HOW DO I MAKE CLONES FOLLOW THE CLOSEST CLONE OF A DIFFERENT SPRITE!!!!????

fredlovessnails wrote:

Cool_Dude2022 wrote:

fredlovessnails wrote:

I want to find out how to make a clone of lets say sprite 1 follow another clone of lets say sprite two
e.g:

:0 these are both clones
:0 will move towards
:0
:0
:0



PLS
This should help; it's a project made by me.
https://scratch.mit.edu/projects/964418154/editor/


from fredlovessnails, i need both sprites to be clones, your example cointains a sprite And a clone

https://scratch.mit.edu/projects/1154090576/

This should be what you're looking for. I remixed my other project to make a clone point at a clone, hope this helped.
10goto10
Scratcher
1000+ posts

HOW DO I MAKE CLONES FOLLOW THE CLOSEST CLONE OF A DIFFERENT SPRITE!!!!????

Cool_Dude2022 wrote:

This should be what you're looking for. I remixed my other project to make a clone point at a clone, hope this helped.

It does not appear to be shared. (Glad I’m not the only one who does this.)
10goto10
Scratcher
1000+ posts

HOW DO I MAKE CLONES FOLLOW THE CLOSEST CLONE OF A DIFFERENT SPRITE!!!!????

https://scratch.mit.edu/projects/1154188108/

I made my own version that uses “helper” sprites to let a clone of one sprite chase a clone of a different sprite.

fredlovessnails
Scratcher
16 posts

HOW DO I MAKE CLONES FOLLOW THE CLOSEST CLONE OF A DIFFERENT SPRITE!!!!????

to cooldude, it says i typed the URL incorrectly
Cool_Dude2022
Scratcher
500+ posts

HOW DO I MAKE CLONES FOLLOW THE CLOSEST CLONE OF A DIFFERENT SPRITE!!!!????

fredlovessnails wrote:

to cooldude, it says i typed the URL incorrectly

I guess I forgot to publish it, I just published it. Let me know if it works.

Powered by DjangoBB