 Here's a fun makey makey project to add to your list. A makey makey operation game for scratch. Grab your scalpel as we construct a game from cardboard and conductive materials, then we'll head on over to scratch, hook it up, and then we'll create some gameplay. All this coming your way. Hello world, Surfing Scratcher here, a teacher-surfer programmer bringing you the goodness of learning to code through video tutorials. If you're new around these parts, consider hitting that subscribe button to stay in the loop. I've also got a link to the Surfing Scratcher mailing list that you can find in the description below. Educators, that's where I'll send out some monthly news and resources straight to your inbox. Alright, here's what you're going to need for this tutorial. Makey makey kit, some foil, a pizza box, some glue, paper clips, scissors, some tweezers, marker, a box cutter. I've got all these materials set up in a kit on kit.com, check the description for more. But hey, grab your scalpel, let's go operate. To help us get a better understanding of what it is that we're going to do, I've got a little plan set up for us. Well, do you remember that pizza box? I'm going to use it to draw a combivan on it and the combivan is what our mechanic is going to operate on. We're going to cut some holes in the pizza box and place four objects. The four objects are a motor here at the rear of the van, the front wheel, some keys to get into our van, and of course a surfboard so we can head down the beach. So we're going to cut some holes around all these objects so we can place them in so we can prize them out with our tweezers. Around the edge of the gaps, we're going to place some foil as a conductive material. The foil here is represented by all these orange outlines around our objects. This is where we can get the makey makey involved. We're going to get an alligator clip and fasten it to the space connection of the makey makey. Then we can wire that into a central spot and then we can run some other alligator clips to it. So that will mean that all the outside foil edges will mean a space bar press. We can then get another alligator cable and run that down to some tweezer connections that we will use to try and prize out these objects. If our tweezers touch the orange edge foil here, well that will mean our circuit is complete for a space bar press. And that is a miss. We can then get two more alligator cables and run them down to some paper clips. We're going to connect one to one of the arrows and the other one to another ground connection. Once we pick up an object, we can place it on the two paper clips. And once we do that, we should have a connection and we can signal success. That's our plan. Let's go make it happen. So you see here that I've got my pizza box and I've just got a piece of paper and with a marker I just went over and created an outline of a combi. Now you're going to need to grab that foil to create four objects. Here I've created a surfboard, created some keys here just for the little four outline and a paper clip, got a little cube motor. And here's just a metallic bottle top that I found. I'm actually just going to wrap that in foil now. So you see here I've placed all of our metallic objects onto the combi van. And what I've done is grabbed a pencil and I've outlined around these objects, not too close because we need to be able to get the tweezers in there as well. So we need to give it a little bit of space. And then what I plan to do is go and grab a box cutter and we're going to cut some holes into our pizza box. Now that we've got our hole there, let's get our object, put it in there and get your tweezers to test it out first. Now that we have these four holes, we need to get some foil so we can place the foil around the edges of the holes. We're going to get some glue and I'm going to put the glue on one side of the foil and smear it with a popsicle stick. Then I'm going to place these foil strips around the edges of these holes. You can see here that all of our edges now have foil attached to them. I've just opened up the pizza box to see what's inside. You can see that we've got the foil edges here. I'm just going to take some paper clips and I'm going to fasten the paper clips to either side of the foil edges. So we'll have some of the paper clip on this side and some of the paper clip on the other side. This is so we can fasten the alligator clips. Here I've attached all the alligator clips. You've got some tape and you can also fasten down the cables too. And then I just fed the cables through these holes in the back of the pizza box. Now we want to take all those cables and connect it to a central connector with just this aluminum foil circle that I've created. We can then take another alligator clip and fasten it to the space connection of the makey makey. Once we've done that, we can take the circle foil that we created early and we can connect the space key to it. So now all of our edge connections mean space. Now I'm ready to attach a cable to the ground. And I've just got some tweezers and I've just put a paper clip on the end of the tweezers there, as you can see. And I'm going to take that yellow cable that we just attached to the ground and attach that to the end of the tweezers, just like that. Let's jump over to scratch and see if this works. Over here in scratch, I've just attached that when the space key is pressed half block and I've also attached a start sound stack block that will play a coin sound. So now when I get my tweezers and I touch the edge of one of these holes, we should get our coin sound. There's our wheel. There's our keys. And there is our surfboard. Boom, and there is our motor. So if we're picking out an object, we should get some feedback if we hit the side. Now that we have our tweezers working, we need to set up the game so we can safely place our objects down when we retrieve them. To do that, I'm going to get two paper clips and we're going to fasten them to the edge of the pizza box here and we're going to need to place the objects down onto them. We'll get some more alligator cables and run these underneath the pizza box back to the makey makey. I'm going to use yellow and green cables to attach to the ground of the makey makey and red and white cables to attach to the buttons of the makey makey. If we open up the pizza box, we can see that we've got all the green and yellow connections to paper clips and all the red and white connections to paper clips. I've also just used some tape to keep our cables out of the way of the holes. Okay, so now all of our cables are hooked up to these paper clips and to the makey makey. We've also got our tweezers set up. It's time to head over to scratch. Over here in scratch, I've just associated all of our key presses with our objects. So the upper is the surfboard. The left there is the wheel. The down arrow is the keys and then right arrow means motor. Now let's bring up our game to see this in action. Okay, I've got our tweezers here. I'm just going to pick up our surfboard and I'll place it on at these surfboard connections. Surfboard, surfboard. Cool, so you know what keys are repeating itself but we can change that later. Let's test out the wheel. Wheel, wheel, wheel. And let's test out the keys. Keys. And lastly, let's check out the motor which is going to be pretty hard to get here. And drop it. Motor, motor. Nice work. Now that we have our tweezers and objects working, it's time to head over to scratch to create some gameplay. So I've just gone ahead and created different sprites for all the objects with a surfer, the wheel, the key and the cog. We've also got some lives here. I just used emojis to help me out with this. When we don't have the object, we're going to display the text of the object that we need. We're going to need a list to help us out with our objects. Let's call it objects. All right, for each object on a green flag plus, drag out a forever block and put in an if and else statement. What we'll do is we're going to get this nice list boolean block here. So we're going to check to see if our objects contains the word surfboard. If it does, we want to switch to the costume surfboard. Otherwise, we want it to be set to the text. You can go ahead and drag this and put it on each of the sprite objects. I've just pressed the green flag and that seems to be working for all of them. Now we need to add the word to the objects list. Let's do the surfboard first. Grab out an if statement, get a not boolean block and get an object contains boolean block to put inside the not block. And the thing that we're going to check to see is if it contains surfboard. So if we press the button and we do not contain the surfboard, let's add surfboard to objects. Now we have that code. Let's place it in there. Make sure that you put the play sound inside of the if block sandwich and we can have our meal. So let's jump back over to the game. I'm going to just grab the surfboard here and watch what happens when I put it on the clips. Surfboard, boom. And we don't get the continuous surfboard plain which is exactly what we're looking for. I've just gone ahead and duplicated that for the other keys there. I've also added a when the green flag is clicked hab block and I'm going to delete all the objects to restart the game. Let's now go add our lives. We'll need new variable, we'll call it lives. And on the green flag click, let's set lives to three. I've just switched out the play sound block for the play sound until done block. Grab an if then block, grab a greater than block and then grab the lies variable. And we want to go if lives is greater than zero. We want to change lives by negative one. Let's connect up that if block to the space key press and let's put that sound inside of that if block. Then inside the lives, right? Drag out a when the green flag is clicked hab block and a forever loop. Drag out the switch to costume block. Drag out an addition operator. Drag out the lies variable and just put a one. So we want to forever switch the costume to whatever the value of lives is plus one. The reason for that is because we've got four costumes here. So when we start the game we want to be on the fourth costume. When it's end game we want to be on the first costume. Just jump back over into the compi sprite and where you've got the when the space key is pressed sequence there. Drag out a weight control block and we just want to wait a couple of seconds just to give the user a chance to get the tweezers away from the foil again. Okay. So if we jump back over to the pizza box so I've got my tweezers in hand I'm going to touch the foil with the tweezers and I'm going to do it again and I'm going to rest my tweezers on there and notice it doesn't update straight away. There we go. Beautiful. So you can actually leave it there and it gives you some time to maneuver it to click it again. It's game over. There we go. The last thing we want to do is to make sure that we can't play our game once it's game over. So let's duplicate this boolean block where the lives is greater than zero. So for all of our arrow presses here we want to add the object if it's not already in the list but also if life is greater than zero because that means the game is still going. So we need an and operator block. We're going to slot that boolean block inside of it and we need to get this one inside that now. So now we've got to combine boolean block by just zoom out a little bit now. You can see we can add the surfboard if we don't contain the surfboard and our lives is greater than zero. Go ahead and duplicate that for the rest of the blocks and we're done. And now it's time to play our game. I'm actually just going to give myself the motor because this hole is too narrow to get it out. So I get the motor. Boom. Okay. Get some surfboards. Surfboard. Boom. Got the surfboard. Let's get the wheel now. Ah, lost a lie. Wheel. And now I need to get the keys. This one's tricky. Ah! And I got the keys. Keys. And I did it. All right, well done. You made it. That's the end of this tutorial. You can go ahead and maybe add some extra bits to this game and show your projects down below. I'd be pretty interested to see what you come up with. It's time for a scratchy question and I want to know what theme did you use for your operation game? Drop your answer in the comment section down below. Okay, thanks for checking out this making-making operation game tutorial. Be sure to smash that like button if you enjoyed it and check out some other content on your screen right now. If you want to show your support for this channel then head on over to my Patreon page, join the mailing list or check out some of my funky red bubble teas that I wear. Links below in the description. But until then, I'm off to go find a wave. I'll catch you in the next one.