[Intro] Hello Fellow Scratchers – This
is a super short but hopefully helpful tutorial on how to create those nice sprite trail effects in
Scratch. They were recently featured in my Boids video, and I got a lot of requests asking how I
did it. So! Without further adieu, I’ll show you! I’ll start by creating a forever loop so that
scratch cat follows my mouse pointer, like this – Now we have something to add a trail to.
So, there are two different approaches to creating trails, Cloning, and Stamping,
each with it’s benefits and drawbacks. [Trails using clones]
First we’ll look at the cloning technique. Drop a create clone of myself into our forever loop…
And woo! We are off. Right away you can see that we are leaving a trail of cats behind our mouse.
And the clones are building up fast… in fact within no time we will hit the 300 clones limit,
and… bam… no more clones can be made so the trail stops forming here!
But not to worry, I wasn’t envisaging having a trail anywhere near this long anyhow.
So how do we make it shorter? Bring in a “When I start as a clone”,
and a repeat 10 loop… Then after 10 repeats, we can
delete the clone. The result of this is that each clone will hang around for 10 ticks of our game,
and then be deleted. That’s cool! [Fading Clones]
But, the effect we are after is for this trail
to fade away gradually rather than just stop all at once.
So, from the looks category, drop in a change effect by block, and we want the “Ghost” effect.
For now, set the change amount to also be 10. And then run the project!
And there we go 😊 – We have achieved a simple sprite trail. That’s really smart.
If I just pause the video for a moment, I would like to point out something, and that is that
the trail left behind by a ghosted clone is visible through the clone in front of it…
This may not bother you, but just remember this for now as I will revisit this later on.
Ok, so we have a trail that is 10 clones long. What if we want longer trails?
[Variable length clone trails] No problem, to make it easy, create a new custom
block. Naming it Fade over, and we need an input of “frames” why not finish with a label “frames”.
And for once, we don’t want to run without screen refresh. That’s because this script
want to perform an animation over a number of frames, not run in a single frame.
So we’ll drop this in as the first block when I start as a clone.
And the following scripts, they can move into the new define block. Nice.
The idea then is we can enter how many frames we want our trail to last for… Let’s try 25 frames.
So our repeat block can now use the “frames”. That will be 25 right now. But what about this change
ghost effect, how much do we need to change this by to make the fade last for 25 frames?
The solution is to consider that a ghost of 100 is fully ghosted, so if we divide that 100 into
“frames”, that is 25 pieces, then that will add back up to 100 after 25 repeats. Perfect.
Run The Project! – Yeah, that’s splendid, very cool indeed!
Now we can choose exactly how long each trail will be.
[Pen Stamping Sprite Trails] So, we did it – So why isn’t this
tutorial over? Well because using clones to create trails is not always possible. You see we only
have 300 clones to work with at any one time, and often we want more than just one sprite to have a
trail. So! I’m going to teach you option 2. And this one uses the pen extension and stamping!
So let’s rewind, and go back to our simple forever loop without any cloning in sight.
Now click on the Extensions button, and choose the Pen extension.
Brill, We can drop an erase all as the first block in our script just to ensure we begin with
a blank pen canvas each time the project runs. And, try placing a stamp block right after moving
the sprite in our forever loop. And here we go again! We have an
endless stamped mouse trail. And this time, no clones being created, and thus, no limit to how
long I can go on drawing this trail! Where we do have a problem is getting
this long trail to fade out, since once we stamp a sprite, it’s no longer changeable. It’s just
part of the background. [Ghosting a Stamp]
Well then, we’ll need another trick. Let me show you something:
Erase all and Click that, and I’ll move Scratch Cat into the open.
Next up, make a new sprite, naming it “Fader”. I’ll make it a bitmap costume, and then fill it
pure white. Yeah, that full obscures Scratch cat now who is behind this Fader sprite.
Scripts… When flag clicked,
go to 0, 0 – to ensure it fully covers the stage. Then go to back.
And hide! That will bring Scratchy into view once more 😊
And, we want to now click into the Scratch cat sprite1, and duplicate the stamp block.
This is what I wanted to show you. Click stamp, and I can move scratch
cat over to the right, leaving behind the stamped cat as expected.
So, what happens if we then stamp the white Fader sprite right afterwards?
Well, no prizes I’m afraid if you guessed that it would stamp the white costume
right over the old stamped cat costume, they are completely erased, not so useful.
Ok, let me set that back up again. Stamping the cat, and come back to the Fader sprite again.
This time though, we set the ghost effect to 50 before we stamp the background.
So this time, when we click these scripts, rather than making the whole stage white, we only fade it
towards white by half, 50% white. That’s cool. Then, stamp that cat again where it is. We get a
fresh bright cat. Back in the Fader sprite, do the stamp again, and not only does the
last stamped cat fade away, but the older faded cat fades out further, even cooler.
This process we can just simply repeat over and over, each click of this fade script makes the
previous stamped graphics fade further and further away, until they finally vanish from view.
I think you get the idea,
let’s put this into practice. [Fading a stamped trail]
Stick the set ghost effect after the other scripts, and bring in a forever loop
for our stamp block. This will now continually fade anything else we try to stamp. In our
case that would be our Scratch Cat, stamped in its own forever loop here.
If we run the project, them well! Can you see the trial? Yes it’s there,
very subtle indeed, but it is there. To make it more prominent,
all we need to do is change this ghost effect to a larger value, approaching 100. Try 90%.
Wow. Guys look at that! Now this is quite a different effect to the clone based trails.
Firstly, if I pause it for a second, see how each cat is NOT transparent? You can’t see the cat
behind showing through. That makes the trail a lot cleaner and less confused. Plus we are no longer
creating tones of clones – That’s a good thing too. But the other difference is that the trail
does tend to have this screen burn effect. Like it fades away, but the last residue hangs around
for a lot longer than you might expect 😊. Well, that is the way of it and how this
method works. Do try changing the ghost effect to different values to alter the effect, it’s quite
fun. And you can try each of the methods, using clones, or stamping and find the one you prefer.
Many Scratch projects use either of these, but if you saw my Boids video, I was using the stamping
method for my Boids there. The reason was that I had way too many clones already to afford using
more just for my trails. [Outro]
So, we come to the end of this tutorial – I hope that was helpful to some of you and that you can
just slot that into your project and have some fun! It works great in many different projects
and games. Feel free to drop me a comment under the video if you’ve had some success with I’d
love to hear what you’ve been up to. If you enjoy watching my videos please smash that like button,
and do subscribe to the channel so as not to miss the next exciting tutorial.
But that’s it for now, have a great week ahead, and Scratch on Guys!