Giant Snake Game Controller
by Vish_R in Circuits > Raspberry Pi
2979 Views, 10 Favorites, 0 Comments
Giant Snake Game Controller
The Milwaukee Makerspace was selected for May 2015 Build Night with Raspberry Pi and Adafruit. The Raspberry Pi 2 Model B is faster than the 1st generation. With the increased speed and the Adafruit Perma-Proto HAT for Pi Mini Kit, I had to build an arcade game controller! So, I decided to build a giant game of snake for Maker Faire Milwaukee. Yes - the game famously played on Nokia phones.
In this game, the individual pixels will be made of milk bottles. A projector controlled via the Raspberry Pi will light up the pixels to display the game.
Bill of Materials
The bill of materials:
- (1) Raspberry Pi 2 Model B
- (1) Adafruit Perma Proto Pi Hat
- (1) Projector
- (1) Small Arcade Joystick from Adafruit
- Plastic Enclosure
Controller
Game control is done via a joystick connected to a Raspberry Pi's GPIO.
Initially, I soldered female headers to the Perma-Proto HAT so they could be secured to the Raspberry Pi's GPIO. Then, I soldered on screw terminals for the joystick wires. The screw terminals connect the joystick to the Pi's "Digital Inputs".
I used the following script from Adafruit to convert the high signals from the switches to keyboard commands. I simulated arrow keys to coincide with joystick directions.
Enclosure
I used a transparent enclosure so players could see the "guts" of the system. I drilled (4) holes on the top of the enclosure and screwed the joystick on. The Pi was placed in the enclosure with double-sided tape.
Software
The game software was a modification of Gareth Halfacree's code from the Raspberry Pi User Guide. It is written using Python and Pygame library. Code can be found here.
I still have to build the physical "pixels." They will be ready by September for Maker Faire Milwaukee.
A preview of the game is attached.
.