Get ready for your New Year's Party with our DIY Party Pack!
In this guide, you will learn THREE ways to program the click input with Scratch. Plus, we will also show you how to access click on the back of your Makey Makey.
Use "when this sprite clicked" block |
To control click, you can use the "when this sprite clicked" block located in the "event" palette. However, since, your mouse will need to actually click on the sprite, you would have to hover your mouse over the sprite for this effect to work. Since this is true, it would probably be best to only use this on a stationary sprite if you want to use "click" input on the Makey Makey. However, there are two other ways to use click that might be useful if you want to use this effect on something in your game that doesn't require you to hover over it first. Read more about the "when this sprite clicked" block on the Scratch wiki. Picture 1: Scratch 2 Picture 2: Scratch 3 |
|
Use "mouse down" block |
You can also use the "mouse down" sensing block, to control a sprite anywhere on the screen. But note the way I've coded it; once I click the "green flag" my sprite will start spinning. To have more control over when you want the "mouse down" to have an effect, try using the broadcasting blocks to trigger the event. Read more about using the "mouse down" block on the Scratch wiki. Picture 1: Scratch 2 Picture 2: Scratch 3
|
|
Use "when Stage clicked" block |
One of the easiest ways to control the mouse click is to use the "when Stage clicked" block. This event will trigger no matter where you click on the backdrop of your Scratch game. So put your game in full screen mode, and you should be able to click away! You will only see this block in "events" if you click on "Stage" to the left of your sprites. The stage is where you can change and update backdrops. Read more about the "when Stage clicked" block on the Scratch wiki. In Scratch 3, the Stage and backdrops have moved the right hand side of your screen. To access the stage for coding, make sure the Stage is highlighted blue as in picture 4. Picture 1 and 2: Scratch 2 Picture 3 and 4: Scratch 3 |
|
Another "click" on the Makey Makey controller |
You can also control click (and all of your mouse movements!) by using a jumper wire in the far right header on the back of your board. In the pic above, I have the jumper wire in "right click." That's all the ways I know of to incorporate "click." If you know of more, please feel free to tell us in the comments. Don't forget to have fun, hack and remix. |
|
Math, Science, Art, Coding, Computational-thinking, Accessibility