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 Appuie sur le champignon (Part 1 of 2)

Transcript

In this step, I'll show you how to create a variable slider to control the racer’s speed. To code this, click on player 1 and data, then select “make a variable.” A variable is: In this case, it's speed. Name this variable “speed,” and select “for this sprite only.” Scratch has now created variable blocks for the speed variable.

I'll drag the speed value into my "move 10 steps" block.

Now, whatever value this variable has will replace the 10 steps that were in the block before.

Notice that right now, the variable has a value of 0. So when I click the up arrow, my sprite doesn't move.

You will see that there's a checkbox next to this block in the scripting menu.

If I uncheck this box, the variable box disappears on the stage.

If I double click this display two times, the user then has a slider that they can control the value of the speed, Let's try changing the speed. Let's try changing it to 5, and a see what happens.

Whoa! The racer is moving pretty slowly.

Let's try changing this value to 20.

Wow, my racer is moving really fast!

You can do this for the player 2 sprite as well. Just be sure to select the “for this sprite only” check box when you create the variable.

Once you complete this step, you can move on to part 2, where you will use the speed variable to slow the driver when they’re on the grass on concrete.

Choisir une extension
Modifie ton circuit
Ajoute un bouton qui change l'arrière-plan circuit.
Changement de costume
Change l'apparence des coureurs lorsqu'une touche est appuyée.
Appuie sur le champignon (Part 1 of 2)
Change la façon dont les coureurs se déplacent, puis fais-les ralentir sur l'herbe.
Appuie sur le champignon (Part 2 of 2)
Change la façon dont les coureurs se déplacent, puis fais-les ralentir sur l'herbe.
Bruitages d'accident
Joue un bruitage d'accident chaque fois que les coureurs se percutent.
Supporters
Programme un lutin pour qu'il effectue un compte à rebours pour le départ de la course et qu'il encourage les coureurs.
Trace de couleur
Ajoute un effet de trace de couleur aux coureurs.
arrow_backward Retour
Suivant arrow_forward
Instructions
  1. Choisis une extension, et clique sur le bouton "Regarder" pour découvrir comment la créer.
  2. Quand tu as fini, reviens à l'écran des extensions et essaies-en une autre !