In this add on, you’ll program the player sprite’s costume so that it changes if ittouches the chaser sprite.
Each sprite has a costume, or several costumes, that control how the sprite looks, kind oflike disguises the sprite can wear to make it look different. To add a costume the playersprite 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 costumesto choose from. You can delete costumes by clicking the “x” over the sprite, andyou 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 thecode 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 spriteis touching the chaser the costume changes instantly and doesn’t stop changing untilthe 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 theplayer sprite. Remember, if you need help, ask your neighbor or put up your sticky toget the attention of your CS First Guru.
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.
Crea una nuova variabile che memorizzi l'attuale punteggio più alto.