What are sprites? In the context of computer graphics, a sprite refers to a two-dimensional bitmap image that is integrated into a larger scene. That might seem like a bit of a convoluted description, but just think of a sprite as an object in your program that will perform actions.
The actions that a sprite performs depends entirely on the code that you've written. Some examples of actions in Scratch might be:
When you open a new project, the default sprite that you'll find on your stage is Scratch Cat (who also serves as Scratch's mascot). But you're not limited to just Scratch Cat! There are four different methods at your disposal if you want to use your own sprites. You can find them in the Sprite Pane, which looks something like this:
Let's have a look at what each individual option does:
1. Importing sprites from the Scratch library
Scratch has a range of pre-made sprites, sorted into Categories, Themes and Types. While Categories and Themes may seem straightforward, you might find yourself wondering what those two words under Types mean. Don't worry — we'll be going over what bitmaps and vectors are in another post. For now, just know that bitmaps and vectors are two different types of images.
2. Making your own sprite
You can draw your own sprites, too! Clicking the paint brush will open up an editing window in the Costumes tab, where you'll be able to draw your own sprites using an assortment of tools. You'll notice, if you look at the bottom right hand corner, that there are two editing modes: bitmap mode and vector mode. You can freely convert between these two modes, but you don't need to know too much about the difference between them just yet — we'll go over that in another post. (Tip of the day: If you're familiar with Microsoft Paint, then the options that bitmap mode presents might seem a bit friendlier to you!)
3. Importing sprites from your computer
If you have existing images on your computer that you want to use as a sprite, you can do that by clicking on the folder icon. Doing so will open up a dialogue box, which you can use to locate your file and import it into your project.
4. Creating sprites by taking pictures with your device's camera
You can also create sprites from pictures taken directly with your device's camera. You could use your computer's webcam, for example, to snap up your next sprite.
Once you've created or imported a sprite into your project, it will appear in the Sprites Info Area, which you can find just under the Sprite Pane:
See the blue "i" in the top left hand corner of the active sprite? If you click on that, then you can view more detailed information about a particular sprite:
In this view, you get to see a couple of details:
You can see the name of your sprite (in this instance, it's called "Sprite1"), and change it if you like.
You can see the current coordinates of your sprite — it's X and Y position, in other words. You can see that Sprite1 above is located at (-8, 0).
You can see the direction it's facing, and change it if you like. Whether your sprite rotates, flips or does neither of the above when you change its direction depends on the rotation style you have selected.
There are three different types of rotation styles:
Rotation: Allows you to rotate your sprite anywhere on the 360° spectrum.
Flip: Allows you to flip your sprite horizontally.
Lock: Prevents you from rotating your sprite.
The can drag in player option determines whether or not you can move a sprite while the project is playing (i.e. after you've started your program by pressing the green flag).
You can also make your sprite visible or invisible using the show/hide option.
So, to summarise all of that: a sprite is a two-dimensional image that is part of a larger scene. It is essentially an object that performs an action. An action can really be anything from moving your sprite, to having it say something on the screen, to playing a sound. There are four ways to add them into your project: you can import pre-made ones from the Scratch library; you can create your own sprites using the Costumes tab editor; you can import sprites from your computer, or you can create sprites from images that you take with your device's camera.
By Erika Chumpia