In this step, you’ll make the graffiti project interactive by enabling the user to choosewhere 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 beingtested. For this project, the user will paint if the mouse button is pressed down, so “mousedown” 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” blocks.
Try it out!
If the mouse button is pressed down, the spray paint sprite stamps. If the mouse button isnot 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 worktogether all the time to help each other find and fix bugs in their code.
Now it’s your turn: 1. Make the trail appear only when the mousebutton is held down using an “if/then” and “mouse down” block.
2. Clear the screen using a “clear” block. 3. Add a “when green flag clicked” block.