Don't Touch The Spikes
Don't Touch The Spikes game based on a raspberry pi pico 2W
- Author: Andreea Simion \
- GitLab Project Link: https://github.com/UPB-PMRust-Students/project-elizasimion-2004
Descriptionβ
In this project, I want to recreate the game Donβt touch the spikes on a Raspberry Pi, using an LCD display which will work using Embedded-graphics. The player controls a bird using a joystick, while a separate button is used to restart the game after it ends. The bird moves within four walls with spikes and must collect randomly appearing food to increase the score, which is shown on a 4-digit 7-segment display. As the player progresses, the difficulty increases: at a score of 5, an enemy character appears that the bird must avoid; at 10 points, a second enemy is introduced; and at 15 points, three LEDs light up. Buzzers are used to provide sound effects when the player scores or loses. The game ends when the bird touches a spike or an enemy character.
Motivationβ
When I was a child, Donβt touch the spikes was one of my favorite games. I remember spending hours playing it with my cousin, always competing to beat each other's high scores. I was fascinated by how such a simple game could be so fun and addictive, and I wondered how it was made. Now, as a university student, Iβm excited to finally have the opportunity to learn the skills needed. This project allows me to apply the technical skills Iβve gained while also reconnecting with a childhood memory.
Architectureβ
β’ Raspberry Pi Pico 2W
Acts as the main microcontroller that runs the game logic, handles input from components, drives the display, and controls game events like scoring and game over.
β’ LCD Screen
β SPI - Raspberry Pi Pico 2W
Displays the game's graphics using the Embedded-graphics library.
β’ Joystick
β ADC - Raspberry Pi Pico 2W
Serves as the player's input device to control the movement of the bird within the game area.
β’ 4-Digit 7-Segment Display
β GPIO - Raspberry Pi Pico 2W
Shows the player's current score in real-time as they collect food during the game.
β’ Buzzer
β PWM - Raspberry Pi Pico 2W
Provides sound effects for scoring or losing
β’ Breadboard
Used to connect all the electronic components
β’ Push Button
β GPIO - Raspberry Pi Pico 2W
reset button
β’ Wires
Used to connect all components to the Raspberry Pi Pico
β’ LEDs
β GPIO - Raspberry Pi Pico 2W
Light up when the player reaches certain scores
Logβ
- Week 5 - 11 May: Planned the architecture of the project, bought all the required components and created the documentation of the project.
- Week 12 - 18 May:
- Week 19 - 25 May:
Hardwareβ
Schematicsβ
KiCAD schematics
Bill of Materialsβ
Device | Usage | Price |
---|---|---|
Raspberry Pi Pico 2W | the microcontroller | 40 RON |
LCD screen | displays the game | 70 RON |
Joystick | player's input device | 5.41 RON |
4-Digit 7-Segment Display | current score in real-time | 6.10 RON |
Buzzer | sound effects | 1.4 RON |
Breadboard | connect all the electronic components | 10 RON |
Push Button | restart the game | 1.02 RON |
Wires | connect the components | 10 RON |
LEDs | light up after a certain score | 0.3 RON |
Softwareβ
Library | Description | Usage |
---|---|---|
embedded-graphics | 2D graphics library | Used for drawing to the display |
embassy-embedded-hal | SPI and I2C library | Used for actually configuring the SPI lcd |
embassy-rp | Closest to a default library | Used for SPI, GPIO pins and peripherals |
rand | Rust crate for random number generating | Used for creating a random position for the "food" |
heapless | Enables the use of fixed-size data structures that do not require heap memory | Managing strings and vectors that have a fixed capacity |
embassy-time | Provides time-related utilities | Managing delays and scheduling tasks |
ili9341 | Driver for TFT LCDs using the ILI9341 controller | Render 2D game graphics |
driver-3461bs-rs | Supports functions for controlling the screen's pixels, colors, and other display settings | Render text, graphics, or animations on the screen |
adc | ADC driver | User for controlling the joysticks |
pwm | PWM module | Used for controlling the buzzer |