Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Clones targeting clones
- ResExsention
-
1000+ posts
Clones targeting clones
Sort of like (pseudocode):
The clones are from two different sprites, and there will be multiple clones. How could I accomplish something like this?
I'm looking for generic answers here, so please don't ask me to share the project…
if clone a gets too close to any clone b:
tell clone a to start shooting at nearest clone b
The clones are from two different sprites, and there will be multiple clones. How could I accomplish something like this?
I'm looking for generic answers here, so please don't ask me to share the project…
- deck26
-
1000+ posts
Clones targeting clones
Search in Scratch for ‘nearest clone’ and you should find something that will help.
- ResExsention
-
1000+ posts
Clones targeting clones
Search in Scratch for ‘nearest clone’ and you should find something that will help.
Not exactly the answer I was expecting, but thanks for the tip…
- ResExsention
-
1000+ posts
Clones targeting clones
Uh, bump. @deck26 didn't exactly give me the answer I'm looking for. Also, clone b should be able to target clone a in reverse.
- deck26
-
1000+ posts
Clones targeting clones
clone b should be able to target clone a in reverse.If a has identified b as a target it is trivial enough to set a variable or two and send a broadcast or use lists to match pairs of clones of different sprites. All of this has been done by others. Uh, bump. @deck26 didn't exactly give me the answer I'm looking for. Also,
- Nambaseking01
-
1000+ posts
Clones targeting clones
Huh. Let me do some messing with clones and return to you.
- ResExsention
-
1000+ posts
Clones targeting clones
clone b should be able to target clone a in reverse.If a has identified b as a target it is trivial enough to set a variable or two and send a broadcast or use lists to match pairs of clones of different sprites. All of this has been done by others. Uh, bump. @deck26 didn't exactly give me the answer I'm looking for. Also,
Ohhhhh
That clears up a lot of things and was definitely more useful. Thanks.
Huh. Let me do some messing with clones and return to you.
Yeah. Before I start anything I'll see what you have to say.
- Nambaseking01
-
1000+ posts
Clones targeting clones
Ahh
I tried everything I could, so I think the script should be something like adding the x and y positions to a list and keep counting the itinerary, and then you should probably mess around with the distance value so it arrives at a script that detects when it is close to the sprite/clone. Then the clone should select a random value in the list using the itinerary and point in that direction and start shooting. And of course, the hurt scripts in the clone events.
Hopefully this worked. And sorry for the long wait, I came after a good night's sleep.
I tried everything I could, so I think the script should be something like adding the x and y positions to a list and keep counting the itinerary, and then you should probably mess around with the distance value so it arrives at a script that detects when it is close to the sprite/clone. Then the clone should select a random value in the list using the itinerary and point in that direction and start shooting. And of course, the hurt scripts in the clone events.
Hopefully this worked. And sorry for the long wait, I came after a good night's sleep.

- deck26
-
1000+ posts
Clones targeting clones
The
There are examples with and without lists. Ahh
I tried everything I could, so I think the script should be something like adding the x and y positions to a list and keep counting the itinerary, and then you should probably mess around with the distance value so it arrives at a script that detects when it is close to the sprite/clone. Then the clone should select a random value in the list using the itinerary and point in that direction and start shooting. And of course, the hurt scripts in the clone events.
Hopefully this worked. And sorry for the long wait, I came after a good night's sleep.
- cannonball84
-
58 posts
Clones targeting clones
My Solution:
Just make the whole project into lists and pen (ideally stamp), that way there wont be overly complected issus like this
Just make the whole project into lists and pen (ideally stamp), that way there wont be overly complected issus like this
- Nambaseking01
-
1000+ posts
Clones targeting clones
My Solution:
Just make the whole project into lists and pen (ideally stamp), that way there wont be overly complected issus like this
Stamps cannot move — so Res has to use clones.
- deck26
-
1000+ posts
Clones targeting clones
That's no reason why not, just means the screen needs redrawing each frame which is not unusual for pen projects.My Solution:
Just make the whole project into lists and pen (ideally stamp), that way there wont be overly complected issus like this
Stamps cannot move — so Res has to use clones.
- ResExsention
-
1000+ posts
Clones targeting clones
That's no reason why not, just means the screen needs redrawing each frame which is not unusual for pen projects.My Solution:
Just make the whole project into lists and pen (ideally stamp), that way there wont be overly complected issus like this
Stamps cannot move — so Res has to use clones.
My Solution:
Just make the whole project into lists and pen (ideally stamp), that way there wont be overly complected issus like this
Stamps cannot move — so Res has to use clones.
The reason why I am using stamps is because I have complex art planned. No way I'm going to try to figure that out with pen…
Thanks, though. Nammy, I'll try your suggestion.
- Nambaseking01
-
1000+ posts
Clones targeting clones
~snip~
Thanks, though. Nammy, I'll try your suggestion.
Work notification, please.

- Discussion Forums
- » Help with Scripts
-
» Clones targeting clones