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 Change Up the Player

Transcript

In this add on, you’ll program the player sprite’s costume so that it changes if it touches the chaser sprite.

Each sprite has a costume, or several costumes, that control how the sprite looks, kind of like disguises the sprite can wear to make it look different. To add a costume the player sprite can change into if it touches the chaser sprite, first click on the player sprite, then on the costumes tab.

Depending on the sprite you chose as the player sprite, you may have one or many costumes to choose from. You can delete costumes by clicking the “x” over the sprite, and you can choose new costumes by clicking “choose new costume from library.”

Once you select some costumes for your sprite, click the scripts tab to program them to change.

From the looks menu, drag out a “next costume” block. Click it a few times.

You’ll notice the sprite changes costumes.

The costumes should change if the player is touching chaser 1, chaser 2 or chaser 3.

To make that happen, go to control and select an if statement.

You could make a separate if statement for each chaser, but it’s easier to just use “or” operators to make the code read: if touching chaser 1 or chaser 2 or chaser 3, then change costumes.

With the ‘or’ operator, any of these conditions could be true and the computer will run this code.

Test your code.

Is it working?

Wow! The sprite’s costumes change when the player touches a chaser.

Those costume changes seem a little fast. This is because anytime the sprite is touching the chaser the costume changes instantly and doesn’t stop changing until the two sprites are done touching. To fix this, add a “wait 1 second” block after “next costume,” to make the sprite wait 1 second before changing its look.

See if that worked.

Nice! Now, it’s your turn to to add more costumes for the player sprite. Remember, if you need help, ask your neighbor or put up your sticky to get the attention of your CS First Guru.

Choose an Add-On
Play a Sound if Caught
Add a sound to your game and program your project to play that sound.
Play Your Game with a Friend
Program one sprite to be controlled by another player.
Change Up the Player
Change up your player's costume whenever it touches another sprite.
Speed Up the Chase
Make the game harder by making the chasers faster.
High Score!
Create a new variable that stores the game's current high score.
arrow_backward Back
Next arrow_forward
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!