Skip to content

Please update your browser

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

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.

Scegli un’estensione
Riproduci suono se preso
Aggiungi un suono al tuo gioco e programma il progetto a riprodurre quel suono.
Gioca con un amico
Programma uno sprite affinché sia controllato da un altro sprite.
Cambia il giocatore
Cambia il costume del giocatore quando tocca un altro sprite.
Accelera la caccia
Rendi più difficile il gioco velocizzando l'inseguimento.
Punteggio alto!
Crea una nuova variabile che memorizzi l'attuale punteggio più alto.
arrow_backward Indietro
Avanti arrow_forward
Istruzioni
  1. Fai clic su qualsiasi casella per andare al video sui componenti aggiuntivi.
  2. Quando hai terminato, torna sulla schermata dei componenti aggiuntivi e prova un altro componente aggiuntivo!