How to avoid clone multiplication

If I made any mistakes, I'm open to feedback as this is my first guide on the Snap! forums.

So, let's say that you're making a shooter game, and you use broadcasts to spawn bullets, if you're keeping track of the clone count, you may notice that the number goes REALLY high, even when you've only shot ten times, why is this?

To put it short, clones can receive broadcasts, so find a way to differentiate between clone and original sprite.

For a long fix, you can make a variable that's for the sprite only, then set the variable to true for clones, and false for the main sprite, you can name this variable whatever, it doesn't really matter. After that, place an if check at the very top of the wanted broadcast hat to stop the code from executing further it it is a clone receiving the broadcast, it should look something like this:
Untitled script pic (1)

By the way, the "= true" part is unnecessary, and is purely for demonstration, you can just drop the variable in the 'if' if you want to.

For a short fix, use "create clone of" instead of broadcasts.

You can find out if you're a clone using untitled script pic (2). (It's called that because clones made by untitled script pic (3) are temporary (i.e., they are deleted when you click the red stop sign or the green flag), as opposed to clones made in the user interface, from the sprite's context menu, which aren't deleted when you start or stop the project.)

There is no need to check for if the variable = true, you can just put the variable into the boolean input in the if block.

Edit: woops, you already mentioned that

:~)

Heh, I kind of just skimmed through the post and saw the image