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 press' 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 program.
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 the 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.
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're gonna play a game.
Drag out a 'when flag clicked' block.
Snap a 'say for two 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.
Program your stylist tool create a colorful trail as it moves around the screen.
Make your stylist tool into a game that lets the user race against the timer to style the model.
Program your model to animate when you place an accessory on it.
Create a stylist critic and program it to give feedback for the stylist project.
Add sound to your project.
Sign in to track your progress and earn badges