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 Gioco infinito

Transcript

This add-on video will show you how to make your project run forever! In the core project, the receivers hid and never came back. In this add-on, the sprite will show up again after it catches the ball. To make the sprite wait before continuing, from the “control” menu, place a “wait” block after the “hide” block. Then, from the “looks” menu, place a “show” block after the “wait” block.

To make testing the code easier, delete the other receiver sprites so that only the modified sprite shows up.

Click the flag to test the code. When you pass the ball to the receiver sprite, it catches the ball, waits, hides, waits, then reappears. That’s cool, but the costume should switch back to the “Moving” costume when it re-appears. Fix this by adding a “switch costume to Moving” block right before the “show” block.

It might be more fun if the receiver shows up at a random place on the screen rather than in the same place where it received the ball.

To make that happen, from the “motion” menu, place a “go to x y” block above the “show” block. Then, from the “operators” menu, place one“pick random” block in the x section of the “go to” block and another “pick random” in the y section.

Negative 240 is the farthest left x location on the screen, and positive 240 is the farthest right. Place those numbers in the first “pick random” block. Similarly, negative 180 is the lowest y spot on the screen, and 180 is the highest. Place those numbers in the second “pick random” block. Test the code by clicking on the flag. Now, when the receiver catches the ball, it hides, waits a little, and reappears in a random place on the screen. Good. Now, duplicate this sprite so you have multiple receivers. Test your code often! Computer scientists like you test their code often so when something doesn’t work, they have a better idea of what caused it.

Here's the gameplan: Add a “wait” block after the receiver sprite hides. Make the sprite go to a random spot on the screen. Then, make it reappear.

Scegli un’estensione
Gioco infinito
Fai scomparire e ricomparire gli attaccanti ogni volta che passi loro la palla.
Passa indietro
La palla ritornerà sempre nella sua posizione iniziale.
Potenza e velocità
Aggiungi delle variabili realistiche con cursori che permettono di controllare la velocità della palla e degli sprite Attaccante.
Segnapunti
Conta quanti passaggi riesci a completare.
Passa la palla
Modifica l'aspetto dello sprite Palla.
Esultare
Fai dialogare gli attaccanti.
arrow_backward Indietro
Avanti arrow_forward
Istruzioni
  1. Guarda il video di introduzione.
  2. Scorri verso il basso per visualizzare i componenti aggiuntivi scelti.
  3. Seleziona un componente aggiuntivo e inizia a creare!
  4. Scegli un altro componente aggiuntivo e continua a costruire.