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 Modifier le joueur

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.

Choisir une extension
Jouer un son si attrapé
Ajoute un son à ton jeu et programme ton projet pour qu'il joue ce son.
Jouer à ton jeu avec un ami
Programme un lutin qui sera contrôlé par un autre joueur.
Modifier le joueur
Change le costume de ton joueur chaque fois qu'il touche un autre lutin.
Accélérer la poursuite
Augmente la difficulté du jeu en rendant les chasseurs plus rapides.
Record !
Crée une nouvelle variable qui enregistre le record actuel du jeu.
arrow_backward Retour
Suivant arrow_forward
Instructions
  1. Clique sur l'une des fenêtres pour accéder à la vidéo de cette extension.
  2. Quand tu as fini, reviens à l'écran des extensions et essaies-en une autre !