4 years ago

Scratch Guide Topic: Sprite Cloning


Sprite cloning is a very useful tool that allows you to make copies of a sprite, especially to platformer games. So, I'll give you some tips.


How can I manage each clone to have their own code?

To do this, it requires an in-sprite-only variable. I would recommend calling it "Clones". This allows each clone to check to see what kind of clone it is. You can make a custom block and set it up like this:

image.png

If you don't know what the bottom one is (That says "for each cone in clones"), it's basically a repeat loop that you can select a variable and then set the number input. When it runs, and when the coding inside that block finished, it repeats and changes the variable by 1. It's basically like the simple repeat block, but also changes the variable number by 1.

And then, you can set up the clones like this:

image.png

This is a useful method, especially to platformer games.


Concerning about messages being broadcasted and the clones take affect from it...

I bet some of you may be wondering, "Why does the clones take affect from broadcasted messages?" Well, that is how clones work. All clones are the same as the primary sprite and they copy literally everything, the variables, the costumes, the sounds, and even all of the coding. You see, according the Scratch Wiki, a clone is a carbon copy of a sprite, but it is otherwise independent. However, there is one way to fix that.

How can I prevent the clones from taking action from broadcasted messages?

To do this, you need another variable. Just name it "Clone?" with a question mark at the end. Then you need to add an IF block at the clone coding and it should look like this:

image.png

And when another message was received, the clones will not run it, and only the primary sprite can.

image.png

And there you go, problem solved.

If you have any questions, feel free to bump your comments.

I cannot guarantee that I can answer every single thing you asked. Yet, I'm not a 100% expert.



14 comments

Loading...

Next up

PlayStation. You once had some form of code. Some honor. And more importantly, part of my childhood.

And look at you now with the PS5 and the upcoming PS6.

Maybe Xbox is gonna take the lead this time. I probably gotta get back to Xbox.

What’s up with my college giving me an entire year of Google AI Plus?

That “Google x Kevin” line does not sit well with me.

So, there’s a campaign called #PSBlackout where we’re supposed to shut down our consoles and refuse to go online from August 23rd to 30th?

Count me in. I’m doing it. I would love to see how this unfolds.

New Inverted head perspectives

credit for @CrystalC_ for giving me 3D renders to make these

So, Sony's CFO (this woman) kind of responded to the massive disc backlash, but her statement is not exactly a satisfying one to listen to.

Ricky Remodel thingymajiggy

Let’s goooooo…

Wuthering Waves is over 2 years old, which is short, but it has a bit more than Genshin Impact, and it’s already getting an Anime adaption.

I’m quite excited for this, that is, if they don’t animate anything stupid in it.

Wait a minute, I thought Intel Celeron and Pentium got discontinued in 2023.

Those two were literally the weakest chips (2 to 4 cores total) and I haven’t seen anybody using them anymore, like they’re actually too slow.

troubleshooting

Oh my gosh, new discovery has been made where Xbox exposes 2 different inputs when you connect even just one Xbox controller to your PC. This will stop people from playing my game with a controller.

And this design was left as is after the 360 era? Geeez.