Skip to content

Please update your browser

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

arrow_back Costume Change

Choose an Add-On
play_circle_filled
Change Up your Racetrack
Add a button that changes the racetrack backdrop.
arrow_forward
play_circle_filled
Costume Change
Change what the racers look like when a key is pressed.
arrow_forward
play_circle_filled
Step on the Gas (Part 1 of 2)
Change how fast the racers move, then make them slowdown on the grass.
arrow_forward
play_circle_filled
Step on the Gas (Part 2 of 2)
Change how fast the racers move, then make them slowdown on the grass.
arrow_forward
play_circle_filled
Crashing Sounds
Play a crashing sound each time the racers hit each other.
arrow_forward
play_circle_filled
Race Fans
Program a sprite to count down to the start of the race and cheer.
arrow_forward
play_circle_filled
Color Trail
Add a colorful trail effect to the racers.
arrow_forward
  • 1. Opening the Starter Project
  • 2. Move the Sprite
  • 3. Moving More Smoothly with "Repeat Until"
  • 4. Add-Ons
  • 5. Reflection
  • 6. Wrap-up: A Racing Game
  • 7. Wrap-up: Share Your Project
  • 8. Wrap-up: Show Your Project
arrow_backward Back Next arrow_forward
Transcript

To make this game even more fun and interesting, you can change how the sprites look with a costume change. In this add-on, you’ll learn how to change costumes for player 1 and player 2 when the 1 and 2 keys are pressed on the keyboard.

If you click on player 1 and the costumes tab, you’ll see there are three costumes for this sprite available in the starter project. If you want to choose more costumes, simply click “choose costumes from library,” and select the costumes you want to add.

Click the scripts menu, and select looks. Add a “next costume" block, which changes the sprite’s costumes. When you click on this block, it changes the costumes of the player 1 sprite. Finally, add an event to tell the computer when to change the player 1 sprite’s costume. The user should be able to change the costume by pressing a key on the keyboard, such as the space key. To make that possible, select a “when space key pressed” block. Choose any value that makes sense for player 1--this example uses 1, but play around with the values until you find one you like.

Time to test your code! Press the 1 key and… Look at that! The costume changes.

To program player 2, code this in the same way, but with a different keypress event that uses a different key than the one you programmed for player 1.

Finally, add instructions to the project page that tell your users how the project works.

Now, it’s your turn: Add more costumes to your player sprites.

Program costume changes using “next costume” and “when key pressed” blocks.

Instructions
  1. Choose an Add-On, and click "watch" to learn how to build it.
  2. Once you finish one Add-On, try another one below the video!