7 min read

Add sprites to the stage

In the first part we learned that if we want something done in Scratch, we tell a sprite by using blocks in the scripts area. A single sprite can’t be responsible for carrying out all our actions, which means we’ll often need to add sprites to accomplish our goals.

We can add sprites to the stage in one of the following four ways: paint new sprite, choose new sprite from file, get a surprise sprite, or by duplicating a sprite. Duplicating a sprite is not in the scope of this article. The buttons to insert a new sprite using the other three methods are directly above the sprites list.

Let’s be surprised. Click on get surprise sprite (the button with the “?” on it.). If the second sprite covers up the first sprite, grab one of them with your mouse and drag it around the screen to reposition it.

Getting Started with Scratch 1.4 (Part 2)

If you don’t like the sprite that popped up, delete it by selecting the scissors from the tool bar and clicking on the sprite. Then click on get surprise sprite again.

Each sprite has a name that displays beneath the icon. See the previous screenshot for an example. Right now, our sprites are cleverly named Sprite1 and Sprite2.

Get new sprites

The create new sprite option allows you to draw a sprite using the Paint Editor when you need a sprite that you can’t find anywhere else. You can also create sprites using third-party graphics programs, such as Adobe Photoshop, GIMP, and Tux Paint.

If you create a sprite in a different program, then you need to import the sprite using the choose new sprite from file option. Scratch also bundles many sprites with the installation, and the choose new sprite from file option will allow you to select one of the included files.

The bundled sprites are categorized into Animals, Fantasy, Letters, People, Things, and Transportation, as seen in the following screenshot:

Getting Started with Scratch 1.4 (Part 2)

If you look at the screenshot carefully, you’ll notice the folder path lists Costumes, not sprites. A costume is really a sprite.

If you want to be surprised, then use the get surprise sprite option to add a sprite to the project. This option picks a random entry from the gallery of bundled sprites.

We can also add a new sprite by duplicating a sprite that’s already in the project by right-clicking on the sprite in the sprites list and choosing duplicate (command C on Mac). As the name implies, this creates a clone of the sprite.

The method we use to add a new sprite depends on what we are trying to do and what we need for our project.

Time for action – spin sprite spin

  1. Let’s get our sprites spinning.
  2. To start, click on Sprite1 from the sprites list. This will let us edit the script for Sprite1.
  3. From the Motion palette, drag the turn clockwise 15 degrees block into the script for Sprite1 and snap it in place after the if on edge, bounce block.
  4. Change the value on the turn block to 5.

    Getting Started with Scratch 1.4 (Part 2)

  5. From the sprites list, click on Sprite2.
  6. From the Motion palette, drag the turn clockwise 15 degrees block into the scripts area.
  7. Find the repeat 10 block from the Control palette and snap it around the turn clockwise 15 degrees block.
  8. Wrap the script in the forever block.
  9. Place the when space key pressed block on top of the entire stack of blocks.
  10. From the Looks palette, snap the say hello for 2 secs block onto the bottom of the repeat block and above the forever block.
  11. Change the value on the repeat block to 100. Change the value on the turn clockwise 15 degrees block to 270. Change the value on the say block to I’m getting dizzy!
  12. Press the Space bar and watch the second sprite spin. Click the flag and set the second sprite on a trip around the stage.

    Getting Started with Scratch 1.4 (Part 2)

What just happened?

We have two sprites on the screen acting independently of each other. It seems simple enough, but let’s step through our script.

Our cat got bored bouncing in a straight line across the stage, so we introduced some rotation. Now as the cat walked, it turned five degrees each time the blocks in the forever loop ran. This caused the cat to walk in an arc. As the cat bounced off the stage, it got a new trajectory.

We told Sprite2 to turn 270 degrees for 100 consecutive times. Then the sprite stopped for two seconds and displayed a message, “I’m getting dizzy!” Because the script was wrapped in a forever block, Sprite2 started tumbling again.

We used the space bar as the control to set Sprite2 in motion. However, you noticed that Sprite1 did not start until we clicked the flag. That’s because we programmed Sprite1 to start when the flag was clicked.

Have a go hero

Make Sprite2 less spastic. Instead of turning 270 degrees, try a smaller value, such as 5.

Sometimes we need inspiration

So far, we’ve had a cursory introduction to Scratch, and we’ve created a few animations to illustrate some basic concepts. However, now is a good time to pause and talk about inspiration.

Sometimes we learn by examining the work of other people and adapting that work to create something new that leads to creative solutions.

When we want to see what other people are doing with Scratch, we have two places to turn. First, our Scratch installation contains dozens of sample projects. Second, the Scratch web site at http://scratch.mit.edu maintains a thriving community of Scratchers.

Browse Scratch’s projects

Scratch includes several categories of projects for Animation, Games, Greetings, Interactive Art, Lists, Music and Dance, Names, Simulations, Speak up, and Stories.

Time for action – spinner

Let’s dive right in.

From the Scratch interface, click the Open button to display the Open Project dialog box, as seen in the following screenshot.

Getting Started with Scratch 1.4 (Part 2)

  1. Click on the Examples button.
  2. Select Simulations and click OK.
  3. Select Spinner and click OK to load the Spinner project.
  4. Follow the instructions on the screen and spin the arrow by clicking on the arrow.
  5. We’re going to edit the spinner wheel. From the sprites list, click on Stage. From the scripts area, click the Backgrounds tab. Click Edit on background number 1 to open the Paint Editor.
  6. Select a unique color from the color palette, such as purple.
  7. Click on the paint bucket from the toolbar, then click on one of the triangles in the circle to change its color. The paint bucket is highlighted in the following screenshot.
  8. Click OK to return to our project.

Getting Started with Scratch 1.4 (Part 2)

What just happened?

We opened a community project called Spinner that came bundled with Scratch. When we clicked on the arrow, it spun and randomly selected a color from the wheel. We got our first look at a project that uses a background for the stage and modified the background using Scratch’s built-in image editor.

The Paint Editor in Scratch provides a basic but functional image editing environment. Using the Paint Editor, we can create a new sprite/background and modify a sprite/background. This can be useful if we are working with a sprite or background that someone else has created.

Costume versus background

A costume defines the look of a sprite while a background defines the look of the stage. A sprite may have multiple costumes just as the stage can have multiple backgrounds.

When we want to work with the backgrounds on the stage, we use the switch to background and next background blocks. We use the switch to costume and next costume blocks when we want to manipulate a sprite’s costume.

Actually, if you look closely at the available looks blocks when you’re working with a sprite, you’ll realize that you can’t select the backgrounds. Likewise, if you’re working with the stage, you can’t select costumes.

LEAVE A REPLY

Please enter your comment!
Please enter your name here