In this step, you'll make
the graffiti project interactive
by enabling the user to choose
where to paint his or her masterpiece.
From the control menu, choose an if/then block.
The top of the block has a space
for the condition or the thing that is being tested.
For this project, the user will paint
if the mouse button is pressed down.
So, mouse down is the condition for this if/else block.
From the sensing menu, drag the mouse down block
into the condition.
To make the spray paint sprite stamp
only if the mouse is down, place the if block
around the go to mouse pointer and stamp block.
Try it out!
If the mouse button is pressed down,
the spray paint sprite stamps.
If the mouse button is not pressed down, nothing happens.
Add a clear block to the beginning
of your block stack to clear the stage.
Finally, add a when green flag clicked block.
If you get stuck, you can always
ask a neighbor to help you out.
Computer scientists work together all the time
to help each other find and fix bugs in their code.
Now it's your turn.
Make the trail appear only when the mouse button
is held down using an if/then and mouse down block.
Clear the screen using a clear block.
Add a when green flag clicked block.
Heads up! You need to run your program in full screen mode for this code to work correctly. Make sure you click the full screen button to test your program.
Sign in to save your project and track your progress.