How to run code on original sprite/object and not clones?

If you have a "when ___, create clone" on an object, the growth is exponential.

What is the simplest or most elegant way to have one button press create only a single clone and not a single clone for each original + clone?

Is it unique ID's in stored in a list? Os it a list of objects itself? Is there a way to check if the block is already running on another object?

untitled script pic (17) maybe like this?

That is basically what is going on. This is a student project:
image

The problem is that every clone is running this code too, so the growth is exponential. If I wait until the clone hits the edge of the screen and deletes then no problem ... but if I try to shoot 12 times quickly there are around 2^12 sprites or around 4,000 bullets on the screen

Untitled script pic

Start projectile from "the battleship" sprite with
untitled script pic (2)

I'm using
image
in my current project

This is what I love about programming. So many different solutions!

Can I ask, why does the parent is a text work? I get the empty parent vs has a parent, but why use "is a text"? Isn't the parent a sprite/object? Is it stored as a text?

Also, I wish I could mark 2-3 solutions. There are always multiple solutions.

1 Like

If you have a parent, the block reports the sprite. If you don't have a parent, it reports an empty string, which is what we use in general for "no result." If I were designing Snap! from the beginning (I'm bending over backward not to say "from scratch" which would be very ambiguous in this context) I'd use False as the no-result convention.