Please update your browser
Your browser version is not supported by this site. CS First may not work properly.
In this video, you will learn how
to turn your graffiti drawing application
Pictionary is a game during which the
first player draws a picture and the
second player guesses what it is
within the time limit.
To build this game,
the program needs to stop the user
from being able to draw after a time limit.
The stop all block in the control menu
will stop the code from running so the user can
no longer draw.
Click on the control menu
and drag the stop all block
into the scripts area.
To wait some amount of time before stopping
the user from drawing,
use a wait until block.
From the control menu, drag out a wait until block
and place it on top of the stop all block.
This block has a space for a condition.
In this case, the program should wait
until there has been more than some amount of time
before stopping the user from being able to draw.
Place the greater than operator
inside the wait until block.
Place the timer variable from the Sensing menu
on one side of the greater than operator.
Type the number of seconds the user will have
on the other side.
This example uses 30 seconds.
Now, the code reads, wait until the timer
has been running for more than 30 seconds,
then stop all the code.
The person doing the drawing should have time
starting the moment he or she clicks the green flag.
Place a when flag clicked event
on top of the wait until block.
Once the timer runs out,
the program should notify the player.
Add the sound Bell Toll from the Sound library.
Add a play sound until done block.
And change the drop down menu to Bell Toll
to make a loud gong noise when time is up.
Test the code.
After clicking the green flag, the user can draw.
But only as long as you gave in the wait until block.
Finally, add instructions to the project page.
Let users know that they will be given a specific
amount of time to draw before they'll be stopped
and someone has to guess what they drew.
Click on see project page
and type your instructions in the block provided.
Now it's your turn.
Make the program stop after a period of time
using a wait until block with the greater than
operator and the timer variable.
End the game by using a play sound until done block
and a stop all block.
Start the new code with a when flag clicked block.
And finally, add instructions letting the user know
how this works.