Makey-Makey Track Runner 1.0!

by mercanmeh in Craft > Cardboard

270 Views, 0 Favorites, 0 Comments

Makey-Makey Track Runner 1.0!

Screenshot 2022-02-09 11.04.41 PM.png

My project on Makey-Makey is a race - you v. the AI. By using the controllers and interacting with the game board, you try to run as quickly as possible to run 50 meters. There are three levels to choose from, from easy to hard (1-3). If even level 3 is too easy, you can compete with friends to get the best time score possible! This instructable will give you a step-by-step guide on how to create this game for yourself! Feel free to be creative and expand on the game if you want.

Supplies

  • Tools:
  • Knife
  • Scissors
  • Hot glue gun
  • Materials
  • aluminum foil (where the player pieces interact with)
  • Cardboard platform
  • Cardboard in the shape of a small shoe (for the playing pieces)
  • Felt or a similar material
  • Duct tape
  • A piece of paper with a track background printed on it
  • Wires
  • The Makey Makey itself

The Scratch Program

Screenshot 2022-01-25 10.07.03 AM.png
Screenshot 2022-01-25 10.22.28 AM.png
Screenshot 2022-02-09 11.12.46 PM.png
Screenshot 2022-02-09 11.09.23 PM.png
Screenshot 2022-02-09 11.04.39 PM.png
Screenshot 2022-02-09 11.09.04 PM.png
Screenshot 2022-02-09 11.20.43 PM.png
Screenshot 2022-02-09 11.21.24 PM.png
Screenshot 2022-02-16 10.29.49 AM.png

The sprites (no code yet - just import the sprite drawings):

  • Set up your ref sprites - one for each racer
  • Set up 3 AI sprites
  • Set up the player controlled sprite

The Variables:

Set up as many variables as you would like. Be careful, though, too many variables can make the program become confusing. Also make sure that it is easy to understand the function of each variable.

Setting up the AI code:

The point of the AI is to also complete the 50 meters, but at an adjustable speed. The random function is so that the AI doesn’t go too quickly, at varying speeds. It also moves across the screen slowly. When it is done with the race, it should announce the time it took to finish the race. 

Setting up the Referee code:

The Referee code is very simple. The sole function of the referee is to show the current distance between its player (the AI or user-controlled sprite - It doesn’t matter) and itself, or the finish line. Once the player finishes, it is supposed to say what place that player finished in.

The final stretch: the player code


Choosing level and code outside of the main algorithm:


There is a small group of functions that need to be made to select the level. You can configure the AI speed (secs) variable in a certain level to make the game easier or more difficult to play. The preliminary code (next page) is made to set some variables to 0 and to put the sprite in its starting position. It then waits until the player presses the up arrow (top right on the playing piece) to start the game. 

It then displays the rather lengthy instructions on how to play the game, then it activates “main”, the main algorithm in this project. The code is meant to routinely end the code (as all of the AIs do as well). 

The algorithm is not a very complicated one, but it is very long and repetitive one may say inefficient. (This is a very improvable aspect of this project). First, it sets some variables to 0 before it starts, and broadcasts DE START OF DE CODE. In this case, this broadcast starts all of the AI’s code. The algorithm is supposed to repeat until the race is done, having run 50 meters (playerpoints). Whenever there is an if statement with the variable playerpos used, it waits for whichever button it is up to be pressed. Once it is, it sets the playerpos variable to its next value and adds 1 meter to its corresponding variable. It also changes the costume and moves the sprite slightly. In the if statements using the playerpoints variable, they also check if the player has finished the race yet, and they stop the algorithm if it has.

The Building

Screenshot 2022-02-16 4.35.53 PM.png
Screenshot 2022-02-16 4.36.03 PM.png
Screenshot 2022-02-16 4.37.20 PM.png
Screenshot 2022-02-16 4.37.41 PM.png

The board:

Cut out  a piece of 10” X 10” piece of cardboard in the back (it’s going to hold everything together). There are 4 small pieces of aluminum used in order to have interactable parts on the cardboard. Most of the aluminum is taped down as seen in the picture. Although it may not be visible (it goes under the tape), those aluminum pieces extend all the way to the edge of the cardboard, where the alligator clips will be attached later.


The playing pieces

For these, you need to get some cardboard scraps (make sure it’s not tiny, make it large enough), and get some cloth, felt, or a similar material. Cut the cardboard into a very small shoe shape, and hot glue the aluminum onto the bottom of that cardboard. Make sure to cover most, if not all of the cardboard’s bottom surface. After that, hot glue (or attach in some way) the cloth onto the cardboard shoe in a way that the players can easily slide their finger in to use it. The ground wires will be put on these. The pictures of the finished playing pieces are on the next page.

Making it all look pretty:

Once the hardware is functioning, (You should test it out to see if it works - wire the entire thing up to your makey-makey and test it out) print out a track background (preferably colored). After testing it out again, you should be complete! Congratulations!


Troubleshooting:

If there is a programming error (the makey-makey feels the button being pressed/interacted with but the desired result is not coming out), check the code and see if there are any errors with the coding. An easy way to pinpoint the problem is to create a temporary variable(s) and configure that variable at specific parts of the code where you think the problem is happening. If the variable doesn’t become the desired value, that is the part of the code that needs to be fixed. If not, find another potential problem place and test it out there.


If there is a problem with the hardware, make sure the aluminum is all connected, and all wires are correctly connected. Wires are very tricky, especially with this project because there are two ground wires.