Introduction: "Space Impact" Game With Gyro Sensor and Nokia 5110 LCD
After my Tamagotchi died (last project), I started searching for a new way to waste my time. I decided to program the classic game “Space Impact” on the Arduino. To make the game a bit more interesting and fun, I used a gyroscope sensor I had lying around as the control of the spaceship.
Step 1: Building the Project on a Breadboard
Hardware is very simple. You need:
- a button and a 10 kOhm resistor
- an Arduino (Uno / Nano / doesn't matter)
- an MPU-6050 Gyro Sensor
- a Nokia 5110 LCD display
- Optional: an active Buzzer and a 20 Ohm resistor
To make things easier, I soldered an shield for the Nokia LCD. There is just the LCD, a switch for the backlight and some pinheads for 5 Volts, GND, etc.
There are different types of the Nokia LCD available. Maybe you have to adjust the wiring or change the program a bit.
Step 2: Programming the Game
Like in my last project I designed all the graphics with paint and used LCDAssistant to convert the pictures into hex.
You can just download the files and upload them on your Arduino. If your set up is correct, everything should work fine. You can change the contrast of your LCD with myGLCD.setContrast(X);.
I added a rar file (gyro.rar) and two separate files (Graphic.c & gyro.ino). You can choose between one of these options. :)
Step 3: Play the Game and Have Fun :)
I implemented two different flightspeeds of the spaceship, depending on the angle the gyro sensor is being held. You have to avoid crashing into other objects like meteorites or just destroy them with laser shots. Some of the obstacles are more durable than others so you’ll have to shoot them twice in order to break them. The enemy spaceships fire back. The goal is to collect as many stars as you can. After your spaceship is destroyed you can see your score and your survived time.
If you want a version with a joystick as the control of the spaceship write me a massage in the comments below. :)