What are Scratch sprites?
Scratch sprites are images kids can create and program in the Scratch interface. Scratch is a block-based coding platform where young creators learn coding fundamentals through visual drag-and-drop blocks (as opposed to text-based coding).
So, such sprites can take the form of shapes and characters, animals, and more.
How are Scratch sprites coded?
Motion blocks are used to control a sprite's movement, looks blocks are used to change a sprite’s appearance, and sound blocks are used to give sprites the ability to make sounds.
With Scratch coding, kids learn how to create talking sprites, change costumes, grow and shrink sprites, have sprites jump up and down, change backdrops, and glide sprites—coding their own cartoon, essentially.
How to create a custom sprite in Scratch
In Scratch, creating a character is called "painting a sprite." (Here is how to make a sprite with Piskel!)
The process is simple, and can be achieved through the following steps:
- Click on the “choose a sprite” button in bottom right corner.
- Click “paint” to open a new sprite.
- Name the new sprite.
Then, kids can create using the following tools:
- Ellipse tool can create a circle shape
- Fill tool can fill the shape with color (like yellow, above)
- Outline tool can change color of the shape’s outline
- Brush tool can be used as a freestyle drawing apparatus
Sprite coding example
Once they've created a sprite, young coders can set up code to apply different effects.
For instance, say they created a butterfly as their sprite in the previous step.
With code, they can learn how to program their sprite to move in a circle, while changing both color and size!
To do so, a repeat loop will need to be created:
It all begins with the green flag, which when clicked, will start the project.
So, the first step would be to drag a when [green flag] clicked block into the scripting area from Events.
Then, a repeat _ block would be dragged in from Control.
Next, a wait _ seconds block would be dragged in and connected to the above repeat _ block.
Last, it would be set to “wait .2 seconds.”
From there, the color effects can be changed using different blocks from the Looks category:
change _ effect by _ block is dragged into the scripting area.
Color should be set to change by 25 (which should be the default).
It’s then connected above the wait _ seconds block and inside the repeat _ block.
Last, a clear graphic effects block is dragged in and connected below the entire repeat _ block.
Now, when the green flag is clicked, the code will switch the sprite through a variety of colors and then set it back to its original state.
How do you coordinate timing between sprites?
Young coders can use events to coordinate timing and communication between different sprites or pieces of their story.
For instance, the when _ key pressed block is an event that starts code whenever the corresponding key on the keyboard is pressed.
So, kids can program this block to trigger speech when a certain key, like the letter “s,” is pressed.
Just like that, kids are off coding!
As you can see, Scratch - through sprites - makes learning to code easy and engaging, introducing kids to the concepts they need to understand before moving on to text-based coding.