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 Piattaforme che si riducono

Transcript

One way to make your game more challenging is to make a platform shrink if the sprite touches it. This screencast will show you how to make shrinking platforms, then you’ll have a chance to create them for your game. First, you’ll need to find a way to shrink the platform sprite. Before, you used the shrink tool to shrink a sprite by clicking on it. With computer science, you can program the computer to do things, like this, for you. In this case, you will tell the computer to shrink the platform if the sprite touches it.

To shrink the sprite, click on looks and drag out the “change size by” block.

Clicking this block makes the sprite bigger. To make the sprite smaller, change this value to a negative number.

Good, that makes it smaller.

This platform should shrink, if the sprite touches it.

Go to control, drag out an if statement, and place it around the “change size by” block Then, go to sensing, drag out a “touching” block, and change the value to the name of the main character sprite.

Now this reads: Now, you need to tell the computer when to check this if statement.

The computer needs to check the if statement the the entire time the program is running.

To make sure that happens, put a forever block around the if statement.

You also need to let the computer know when to run the code. Add a “when flag clicked” block to tell the code when to start running. Test your code to see if that worked.

Whoa!

When the sprite touches the platform, the platform starts to shrink.

There is one problem, though. The sprite never returns to its full size. Anyone who plays this game now will have a tiny platform. Well, that’s no fun!

To fix that, put a “set size to 100%” block just under the “when flag clicked” block.

Now, the platform will always start the game at full size.

Scegli un’estensione
È tempo di festeggiare!
Crea una fantastica celebrazione utilizzando alcune di queste idee.
Piattaforme mobili
Rendi il tuo gioco più impegnativo creando piattaforme mobili.
Piattaforme che si riducono
Crea una piattaforma che si riduce per aumentare la difficoltà del tuo gioco.
Splash! Hai perso
Inventa il modo in cui il giocatore perderà il gioco.
Aggiungi dei brani
Aggiungi una musica di sottofondo al tuo gioco.
Risolvi il bug: Atterra sui piedi... oppure no
Risolvi il bug che permette a elementi diversi dai piedi di uno sprite di stare su una piattaforma.
arrow_backward Indietro
Avanti arrow_forward
Istruzioni
  1. Scegli un componente aggiuntivo e fai clic su "Guarda" per imparare come personalizzare il tuo progetto.
  2. Quando hai terminato, torna sulla schermata dei componenti aggiuntivi e prova un altro componente aggiuntivo!