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 Il gioco dello stilista

Transcript

In this add-on, you’ll make your stylist tool into a game that lets a user race against the timer to style your model! To start, program the accessory sprite to cycle through each accessory. Right now, the “next costume” block is under the right arrow key event. To make the accessories keep changing, remove the “when arrow key pressed” block, and drag out a “forever” loop. Place it around the “next costume” block.

Test your code!

The accessories are cycling very fast! That would make this game pretty difficult. Fix this by adding a “wait” block to your code. Tinker with the value in the “wait” block until you find a number that works best for you and your game. The smaller the number, the more challenging your game will be. Now, add a “when flag clicked” block to make your accessories cycle through as soon as you press the flag.

To make this feel like a game, you’ll need to use a timer. The timer block is a sensing block that displays how many seconds have passed since the user has pressed the flag.

The timer resets every time the flag is clicked. Click the sensing menu, and click the checkbox next to the timer block to show the current timer value. Cool! Now drag the “timer” block into your scripts editor. To program the game to stop running after the timer reaches a certain limit, add a “wait until” block from the control menu. Then, drag out a “greater than” block from the operators menu and place it inside the “wait until” block.

You’ll want this to say “wait until the timer value is greater than 10” so place the “timer” block on the left side of the inequality, and type in the value “10” on the right side of the inequality. You can tinker with the value. Change it to whatever works for your program. The higher the number, the more time a user will have to play your game. To make the program stop running, Scratch has a “stop all” block in the control menu. This block deactivates all the code in your project. Place the block after the “wait until” block. This block stack now reads “wait until the timer is greater than 10, then stop the program.” For this to happen every time, add a “when flag clicked” block to the top of this stack. Now test your code! When the flag is clicked, your accessories cycle through, and you have to race to place them on your model!

Great! Next, the game should let the user know when the time is up!

Add a “play sound pop until done” from the Sound menu above the "stop all" block.

Change the sound to something exciting. This example uses the “triumph” sound.

Click the flag to test. Great!

Once the timer value is greater than 10 seconds, the sound plays and the other code stops running.

Finally, program the accessory sprite to tell the user that they are going to play a game!

Drag out a “when flag clicked” block. Snap a “say for 2 seconds” block below that. Type a message for the user about the game. This example says ”Decorate the person in 10 seconds or less!” Now, it’s your turn!

Make the accessories in the costume menu constantly cycle using “next costume," “forever,” “wait,” and “when flag clicked” blocks.

Then, code your program to stop when the timer reaches 10 seconds using “wait until,” “greater than,” “timer,” “stop all”, and “when flag clicked” blocks.

Add a "play sound until done block" to alert the user that the game is over.

Give the user instructions about your game using a “say” block.

Try your new stylist game with your neighbor! See who can design the model the fastest!!

Scegli un’estensione
Fare il restyling
Crea un nuovo accessorio per il tuo progetto.
Il mouse vistoso
Programma il tuo strumento stilista per creare una scia colorata che si muove all'interno dello schermo.
Il gioco dello stilista
Trasforma il tuo strumento da stilista in un gioco che permetta all'utente di sfidare il timer per abbigliare la modella.
Anima la modella
Programma la tua modella ad animarsi quando gli si pone sopra un accessorio.
Il critico di moda
Crea un critico di moda e programmalo affinché fornisca un feedback per il progetto dello stilista.
Il suono (Sfida)
Aggiungi dei suoni al tuo progetto
arrow_backward Indietro
Avanti arrow_forward
Istruzioni
  1. Fai clic su qualsiasi casella per controllare il video sui componenti aggiuntivi.
  2. Quando hai terminato, torna sulla schermata dei componenti aggiuntivi e prova un altro componente aggiuntivo.