How do you make clones target other clones?

Say, I am making a basic tower defense game where towers can attack enemies and enemies might attack back.
But they are all clones. How should I get to doing that?

I make a thousand mistakes over the course of eight hours trying to accomplish that.

Hi, welcome to the forum!

In the Sensing category, you'll find the MY block. One option is MY [OTHER CLONES], which reports a list of all the siblings of a clone. You can use that with the FOR EACH ITEM block to do something for every clone, or you can use KEEP to select only the ones that satisfy some criterion (e.g., less than a certain distance away).

That's a pretty general reply, but if you want something more specific, you have to post a link to your shared project.

So does this work for other sprites' clones? I had different sprites for the enemies and towers and the towers need to target the enemies' clones which are different sprites?

I tried using the 'a new clone of' block in a test, but that didn't work, instead spawning a new clone of the enemy.

You are probably looking for MY(neighbors) and MY(other sprites)?

clones

I didn't get that to work.
This works: image
And this: image

Right you are. That's what I get for posting it without testing... :~(

Can I get some advice on how to make a clone spawned by another clone inherit that clone's coordinates?
It isn't doing that on it's own. Instead it spawns clones at the parent WAAAAY off screen.

image
This worked when I tested it.

My first guess is that the clone-myself instruction that you think is being run by the clone is really being run by the original sprite. Could you share your code?

@ punchyjuicy
All clones are created at the PARENT's location.
If Parent sprite S1 is at 0,0 and clones itself, the new clone will be at 0,0.
If the new clone moves to 100,100 and clones itself (not cloned by PARENT), then its clone will be at 100,100 as well.
If your clones are positioning at the original PARENT's location, then may be the parent is the one doing the cloning, and not the clone.

In order for the clone to clone itself, one has to use the hat-block "When I start as a clone" and create the new clone from under that block.

thx for the my self. It works perfectly :slight_smile: