Skip to content

Please update your browser

Your browser version is not supported by this site. CS First may not work properly. Learn more

2. Show Off Your Moves

Transcript

In this video, you'll make the athletes in your project look like they're performing.

The example project will build off of the cheerleading starter project, but you'll build your project using the sport you chose.

Click on the sprite you will animate, then click on the Costumes tab.

You'll see pictures of the sprite in a few different poses.

If you click through these costumes quickly, the sprite looks like it's moving.

Computers are useful because you can program them to do tasks for you.

To program the sprite to change costumes, go to the Looks menu and drag out the next costume block.

Click on it.

The sprite changes costumes, keep clicking on it to make the sprite look like its animated.

Pretty cool!

Scratch also offers a block that will continue to change the costumes without you clicking on it over and over.

The repeat block makes actions repeat a number of times.

From the Control menu, drag out a repeat block and place it around the next costume block.

Click on the code to test it.

Interesting.

The costume changes many times but it changes very quickly.

To slow down the costume changes, select a wait block from the Control menu and place it inside the repeat block.

Tinker with the values in the repeat loop and wait block until the animation looks good to you.

Next, add an event that will make the athlete perform.

In computer science, events cause an action in a program.

In this case, a user pressing a key is the event that makes the athlete perform.

Click on the Events menu, place a when key pressed event block on top of the stack that makes the athlete perform.

From the drop down menu, select a key to use as an event.

This example uses the one key.

To test this code, press the key on your keyboard, the athlete starts performing.

Great!

Next, code the rest of the athletes in your project to perform.

The code for the other sprites will be very similar to the code you just created.

Copying code from one sprite to another is easier and faster than creating new code for each sprite.

To copy the code, drag it over to the sprite in the Sprites menu, then change the key press event.

For this example, the second athlete performs when the two key is pressed.

And the third when the three key is pressed.

Tinker with the number of repeats and the wait times for each sprite until you like their performances.

Here's the Game Plan!

First, make the sprite keep changing costumes using the repeat loop and change costume block.

Slow down the costume changes using the wait block.

Make the code run when the user presses a key using the when key pressed block.

Copy the code to the other sprites and change the key press events for each athlete.

Finally, tinker with the values in the repeat loops and the wait blocks until you like what you have.

arrow_backward Back
Next arrow_forward
Instructions
  1. Make the sprite look like it's performing using the "change costume" and "repeat" blocks.
  2. Slow down the costume changes using the "wait" block.
  3. Make the code run when the user presses a key using the "when key pressed" block.
  4. Copy the code to the other sprites. Change the keypress event for each athlete.
  5. Tinker with the values in the repeat loops and "wait" blocks.