A simplified Pac-Man game developed for the micro:bit v2 microcontroller using Rust. This implementation focuses on maze navigation and pellet collection without enemies, making it perfect for learning embedded game development. The game utilizes the micro:bit's hardware features, including its LED matrix display, buttons, and timers, to provide an engaging experience.
- Simplified Pac-Man Gameplay: Navigate through a maze and collect pellets using the micro:bit's button controls, without the pressure of avoiding enemies.
- LED Matrix Display: The 5x5 LED matrix displays the maze, player position, and remaining pellets in a creative, compact format.
- Button Controls: Use Button A and Button B to control Pac-Man's movement through the maze.
- Efficient Memory Management: Leveraging Rust's memory safety features to ensure stable and crash-free gameplay on embedded hardware.
- Real-Time Operations: The game utilizes the embed crate for managing interrupts and real-time clock (RTC) events using critical section to manage concurrency safely.
- Low Overhead: The game is designed to be lightweight and efficient, ensuring smooth performance on the microcontroller.
- Rust: The game is built entirely in Rust, utilizing its powerful embedded ecosystem.
- microbit v2 crate: Provides support for the micro:bit v2 hardware, enabling interaction with buttons, LEDs, and other features.
- embed crate: Used for embedded programming, including handling real-time operations and safe concurrency.
- critical section: Ensures safe access to shared resources in a multi-threaded environment.
To flash the game onto your micro:bit v2, follow these steps:
-
Clone the repository:
git clone https://github.com/yourusername/microbit-pacman.git cd microbit-pacman -
Install Rust for Embedded Development: Follow the setup instructions for Rust Embedded
-
Install Dependencies: Ensure you have the necessary dependencies installed. You can do this by running:
rustup target add thumbv7em-none-eabihf cargo install probe-rs
-
Flash the Game: Use
probe-rsto flash the compiled binary onto your micro:bit v2:cargo embed --release
Once the game is flashed onto your micro:bit v2, you can start playing:
- Button A: Move Pac-Man left/up (depending on game state)
- Button B: Move Pac-Man right/down (depending on game state)
- Objective: Navigate through the maze and collect all pellets to win!
The LED matrix will display your current position and the maze layout. Collect all the pellets to complete the level!
This project is licensed under the MIT License. See the LICENSE file for details.
For any questions or feedback, please contact uwau2544@gmail.com.