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 Plates-formes qui rétrécissent

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.

Choisir une extension
L'heure de faire la fête !
Crée une célébration de victoire de folie en utilisant certaines de ces idées.
Plates-formes en mouvement
Rends ton jeu plus difficile en créant des plates-formes qui bougent.
Plates-formes qui rétrécissent
Crée une plate-forme qui rétrécit pour augmenter la difficulté de ton jeu.
Plouf ! Tu as perdu
Crée une condition pour que le joueur perde à ton jeu.
Ajoute de la musique
Ajoute un fond sonore à ton jeu.
Résolution du bug : Atterris sur tes pieds... ou pas
Corrige le bug qui permet à d'autres choses que les pieds d'un lutin de rester sur une plate-forme.
arrow_backward Retour
Suivant arrow_forward
Instructions
  1. Choisis une extension, et clique sur "Regarder" pour découvrir comment personnaliser ton projet.
  2. Quand tu as fini, reviens à la page des extensions et essaies-en une autre !