Super Bug Bros. - ITTT
This is a project I made for school. It's called Super Bug Bros. The game requires 2 competing players to both mash their button as fast as possible in order to make their corresponding light light up. The game also has a third light. Which signifies that the game has reset and is ready to be played again, this light will also flicker once the players are busy playing.
The idea behind the game is that you're playing as the Super Bug Bros. a pest control duo that's trying to compete amongst themselves. The lights are supposed to symbolise the bugs and the mashing of the buttons symbolises the players smashing the bugs. I tried to decorate the box I put the game in in order to fit with this concept.
Supplies
- Arduino UNO
- Breadboard
- 3 LED lights of different colours (I chose green and orange for the players and yellow for the starting light)
- 2 arcade buttons
- 5 resistors (brown - black - red - gold)
- Wires
If you want to decorate the box like I have you'll also need:
- 3mm MDF wood for lasercutting
- Coloured paper (I used black and pink)
- Some illustrations to make it look fancy
If you'd like to be able to close the box you put it in you'll obviously need a power source to connect the Arduino to. Such as a battery or a powerbank.
Wiring
In the image you can see how to wire this game. The wires are colour coded to which light and it's corresponding button they help connect. If you choose to solder the game the wiring will obviously look quite a bit different. The other image is my attempt at doing so.
Coding
Below you can find the code I used to program the game. I also added a description per section explaining what those lines of code do. You should be able to copy this into your Arduino. You can also download the code using the file I added to this step.
//Here I'm creating the score variables//
int score = 0;
int score2 = 0;
void setup() {
//This code is used to designate which pins in the Arduino corresponds to a button or a light//
pinMode(11, OUTPUT);
pinMode(12, OUTPUT); //left
pinMode(13, OUTPUT); //right
pinMode(4, INPUT);
pinMode(7, INPUT);
Serial.begin(9600); }
void loop() {
//This code tells the Arduino which pins the buttons are connected to//
int buttonState = digitalRead(4);
int buttonState2 = digitalRead(7);
//This code designates the state the lights should start in, the player lights start out off and the starter light starts out glowing//
digitalWrite(13, LOW);
digitalWrite(12, LOW);
digitalWrite(11, HIGH);
//This code makes the yellow light flicker when either of the buttons are pressed rapidly//
if (buttonState == HIGH) {
digitalWrite(11, LOW);
}
if (buttonState2 == HIGH) {
digitalWrite(11, LOW);
}
//This code makes sure that score is added to player 1 whenever their button is pressed//
if (buttonState == HIGH) {
score = score + 1;
Serial.println(score);
}
//This code makes sure the game resets after a high enough score is reached by player 1//
if (score > 1500) {
digitalWrite(13, HIGH);
delay(5000);
score = 0;
score2 = 0;
}
//This code makes sure that score is added to player 2 whenever their button is pressed//
if (buttonState2 == HIGH) {
score2 = score2 + 1;
Serial.println(score2);
}
//This code makes sure the game resets after a high enough score is reached by player 2//
if (score2 > 1500) {
digitalWrite(12, HIGH);
delay(5000);
score2 = 0;
score = 0;
}
}
Downloads
Decorations
Everything I note in this step is just a description of how I chose to decorate my game, but you can of course do pretty much anything you want here!
I first came up with the concept, when I started the project the LED light reminded me of fireflies so I wanted to do something with bugs. A while after I was searching online for what components I was going to use and then I found some cool arcade button. Because of that I decided I also wanted to make a game in which you could mash some buttons. I combined the 2 concepts and came up with Super Bug Bros. in which you play as 2 pest controllers mashing bugs. In the images you can see the logo I designed for the game, the characters I made for the game as well as how I decorated the box with these characters.
The box I put my game in is made of wood. I used www.makercase.com for this process. You can download my schematic by using the file I added to this step, the top of the box has a few holes, 3 small ones and 2 bigger ones. These are there so you can fit the buttons and lights through. After lasercutting the box I decorated it with black and pink paper, and the characters I made.
After this you should be done! Have some fun with a friend!