1 Hour to a lifetime :)
WHAT WILL YOU MAKE?
WHAT WILL YOU NEED?
- Just a computer with internet access.
Scratch is a very cool way to get start with programming. Very quickly, you can create your own games. Let’s get started by importing our own sprite. Click the import sprite button and select the Makey file.
Wow, Makey came in giant, let’s shrink him down a bit. In the top of the screen there is a shrink button. Click on that and then click on Makey to scale him down some. Now drag him to the lower left corner as a starting point.
Starting the game
To start a Scratch game, you click on the green flag. Click on the events section on the scripts tab to find the “When Flag Clicked” event and drag it right into Makey’s script section.
Now let’s make sure Makey always returns home at the start of the game. Go to the motion section and add “go to x: y:” after the flag event. Set x to -181 and y to -120.
Get him moving
We don’t always want Makey just hanging out at the bottom of the window, so in the motion section add the glide function after the “go to” function. Set the glide to 1 second x:0 , y:0.
To control Makey we need to create new events. Go to the events tab and add a “when key pressed” event. Change the event to “up arrow.”
Now go to the motion section again and select the “change y by” function to attach to the key pressed event. Set it to 10.
Then repeat this for the Down (y -10), Left (x -10), and Right (x 10) keys.
A non-controlled object
Of course if Makey was just hanging out by himself, that would be boring! Let’s add another sprite. Click the import sprites button and select the Arduino. Don’t forget to shrink it down.
Now click on the Arduino sprite. We can see its script window is empty. Add a “when flag clicked” event so it starts at the same time as Makey. Since we won’t be controlling the Arduino, let’s make its motions go on forever by adding the “forever” control after the flag event.
Setting the Arduino
Sine we are not controlling the Arduino, we need to create some code to move it around. In the forever control, add a motion “go to” and set it to random. You may see the Arduino bouncing around the play window. Let’s constrain it a little by adding a motion “set x” function and setting it to 250.
Moving the Arduino
Now that the Arduino can be created at random points on the right hand side of the screen, we want to move it to the left.
Add a control “repeat” after the “set x” function. Set the repeat to 50. Now add a motion “change x by” and set it to -10.
Click on the green flag and watch your creation go. Use your arrow keys to help Makey fly around with the Arduinos!
These are just the first steps in making a game — there’s a lot more to explore in Scratch. Try out some of the tutorials that they have provided and also look at some games that other people have created. All the games in Scratch will allow you to look at the code behind it, so you can see how it works. I added more to the Makey game, which you can check out right here.
Your safety is your own responsibility, including proper use of equipment and safety gear, and determining whether you have adequate skill and experience. Power tools, electricity, and other resources used for these projects are dangerous, unless used properly and with adequate precautions, including safety gear and adult supervision. Some illustrative photos do not depict safety precautions or equipment, in order to show the project steps more clearly. Use of the instructions and suggestions found in Maker Camp is at your own risk. Make Community, LLC, disclaims all responsibility for any resulting damage, injury, or expense.
Kits and Books From Maker Shed
Make: produces a variety of great products and helpful project tutorials to enhance your making experience.