Skip to content

Repository files navigation

The Devour — A Tilt-Controlled Survival Game (CircuitPython)

A hardware-integrated survival game using motion control, rotary encoder input, LEDs, buzzer feedback, and a custom-designed enclosure.

Project Overview

The Devour is an interactive survival game built on CircuitPython and fully integrated with physical hardware, including an accelerometer, rotary encoder, buzzer, and NeoPixel LEDs.
The player controls a character on an OLED screen by tilting the device, avoiding enemies, and collecting food to survive as long as possible.

The game includes:

  • A complete hardware–software system architecture
  • A fully enclosed physical design with a custom-made shell
  • Persistent storage for gameplay statistics and high scores
  • A rotary-based name input interface
  • Animated intro and different endings

This repository contains all code files, libraries, system diagram, circuit diagram, and this README, satisfying all submission requirements.

🎮 How the Game Works

1. Motion-Based Player Control

The ADXL345 accelerometer continuously reads tilt values (filtered through an EMA filter).
The player’s character moves on the OLED screen according to the device’s physical orientation.

2. Game Loop

During gameplay:

  • Enemies spawn and move toward the player

  • ‘Food’ appears at random positions

  • Lives decrease when collisions occur

  • Pixels provide direction-based warnings

  • Sound effects simulate typing

  • The final boss battle and the two different endings that follow.

3. Name Input for High Score

If the player achieves a new longest survival time:

  • The game asks for a two-letter name
  • The rotary encoder cycles through A–Z
  • A button confirms each letter
  • The name and survival time are written to persistent storage (time_survived.txt)

4. High Score & Game Data Persistence

The game saves:

  • Longest survival time
  • Corresponding 2-letter player name
  • Gameplay statistics (bit.txt, time_survived.txt)

Files are rewritten using CircuitPython’s safe-overwrite approach.

Hardware Included

Component Purpose
RP2040 Board (CircuitPython) Game logic execution
SSD1306 OLED Display Game graphics + UI
ADXL345 Accelerometer Player control via tilt
Rotary Encoder + Push Button Menu selection + name entry
Piezo Buzzer Typing & event audio feedback
NeoPixels (x4) Direction warning indicators
Custom Enclosure Protect hardware + improve UX

Enclosure Design Thought Process

I designed the enclosure to look like a classic red-and-white game console. It’s small and compact, so you can easily hold it in one hand, which also makes it fun to tilt during gameplay. I 3D-printed it using a slightly translucent material, so the internal indicator lights can shine through and give the game a more dynamic, interactive feel.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages