How to Change Your Sprite’s Appearance with Scratch on the Raspberry Pi
As well as moving your sprite around the Raspberry Pi screen, Scratch makes it simple to change your sprite’s appearance. It makes your game much more fun if all your characters don’t look exactly the same.
How to use costumes
One way to think of sprites is like the characters in a game. Each sprite can have a number of costumes, which are different pictures of it. If the costumes look fairly similar, you can create the illusion of animation by switching between them. Your cat sprite comes with two costumes, and when you switch between them, it looks like the cat is running.
You can see the costumes for your sprite by clicking the Costumes tab at the top of the Scripts Area. If you want to modify the cat’s appearance, you can click the button to edit one of the costumes, or if you want to create a new animation frame, you can click the Copy button beside a costume and then edit the bits you want to change.
It doesn’t matter so much when you’re experimenting with sprites, but when you make your own games and animations, you can save yourself a lot of brain ache by giving your sprites meaningful names. To rename a costume, click the Costumes tab to show the costumes, and then click the costume’s current name and type its new name.
In the Blocks Palette, there are two blocks you can use to switch between costumes:
Switch to Costume: If you want to switch to a particular costume, choose its name from the menu in this block and then click the block.
Next Costume: Each time you use this block, the sprite changes to its next costume. When it runs out, it goes back to the first one again.
How to use speech and thought bubbles
To see the blocks that affect a sprite’s appearance, click the Looks button above the Blocks Palette.
Scratch includes four blocks you can use to show a speech bubble or a thought bubble on screen. These are great for giving a message to the player or viewer. You can edit the word in the block to change the text in the bubble.
If you use one of the options with a length of time in it, the sprite pauses for that length of time and the bubble disappears when it’s elapsed.
If you use a block without a length of time, you can make the bubble disappear again by using the Say or Think block again, but editing the text so the text box in the block is empty.
How to use graphic effects
You can apply several graphic effects to your sprite using Looks blocks. The Color effect changes the sprite’s color palette. The Fisheye effect works like a fisheye lens, making the central parts of the sprite appear bigger.
Whirl distorts the sprite by twisting its features around its middle. Pixelate makes the sprite blocky. Mosaic shrinks the sprite and repeats it within the space it usually occupies. The Brightness and Ghost effects can sometimes look similar, but the Brightness effect increases the intensity of the colors and the Ghost effect fades all the colors out evenly.
Here are the three blocks you use to control graphic effects:
Change Color Effect by 25: You can select which effect you want to change (by default, it’s the color effect), and enter the amount of it you want to apply, as a percentage (by default, 25 percent). You can use negative numbers to reduce the extent to which the effect is applied to your sprite.
Set Color Effect to 0: Use this block to set a chosen effect to a specific percentage. Choosing 0 turns the effect off again. You can use any of the seven effects with this block.
Clear Graphic Effects: This block removes all the graphic effects you’ve applied to a particular sprite, so it looks normal again.
The graphic effects look great, but they are quite slow. They’re best used in moderation for special moments in your animation or game; otherwise, they make it appear unresponsive.
How to resize your sprite
You can use blocks to issue instructions to change its size too, so you could make it get larger as the game progresses, for example.
There are two blocks you can use to resize your sprite:
Change Size by 10: This block enables you to change the size of your sprite by a certain number of units, relative to its current size. As usual, you can edit the number. If you want to decrease the sprite’s size, use a negative number.
Set Size to 100%: This block sets your size to a percentage of its original size, so with the default value of 100 percent, it effectively resets any resizing you’ve done.
How to change your sprite’s visibility
Sometimes you might not want your sprite to be seen on the Stage. If a space ship is blown up in your game, for example, you want it to disappear from view. These two blocks give you control over whether a sprite is visible:
Hide: Use this block to make your sprite invisible on the Stage. If a sprite is hidden, Scratch won’t detect when it touches other sprites, but you can still move a hidden sprite’s position on the Stage, so it’s in a different place when you show it again.
Show: By default, your sprite is visible, but you can use this block to reveal it again after you have hidden it.