An arcade-style survival game rebuilt with pygame for smoother performance, HD visuals, and cleaner architecture.
- Upgraded from
turtletopygamefor faster rendering and input handling. - Modularized into a package (
game/) with separate config, entities, logic, persistence, and terrain worker modules. - Added background multithreading for terrain decoration precompute.
- Added PNG sprite-sheet asset loading with procedural fallback.
- Added combat feedback: hit slashes, muzzle flashes, and particle bursts.
- Added camera shake and damage flash for impact readability.
- Added sound effects and looping background music.
- Added non-blocking high score persistence with a writer thread.
- Added unit tests and CI checks.
- HD window rendering (
1280x720) with themed backgrounds and cached grid visuals - Real-time movement (
WASDor arrows) - Enemy chase behavior and level-based difficulty ramp
- Hazards (fire, pothole, trap)
- Life system with delayed timed heart pickup
- Mega food bonus every 15 points (limited lifetime)
- Weapon system (unlock at level 3):
- Arrow (single use)
- Gun (15 bullets)
- Capture gun (works on devil)
- PNG sprite-sheet character/hazard icon pipeline (
assets/sprites) - Hit animations: slash, muzzle flash, impact particles
- Camera shake + damage flash on combat/damage events
- Sound FX + background loop music (
assets/audio) - Kill streak event banner
- Persistent high score (
high_score.json) - FPS indicator in HUD
.
├── .github/workflows/ci.yml
├── game/
│ ├── __init__.py
│ ├── assets.py
│ ├── audio.py
│ ├── config.py
│ ├── entities.py
│ ├── effects.py
│ ├── game.py
│ ├── logic.py
│ ├── sprites.py
│ ├── storage.py
│ └── terrain_worker.py
├── assets/
│ ├── audio/
│ └── sprites/
├── tools/
│ └── generate_starter_assets.py
├── tests/
│ └── test_logic.py
├── .gitignore
├── LICENSE
├── main.py
├── pyproject.toml
├── README.md
└── requirements.txt
- Python 3.11+
pygame(installed fromrequirements.txt)
python -m pip install --upgrade pip
pip install -r requirements.txtpython main.pyIf you want to refresh the bundled starter assets:
python tools/generate_starter_assets.pyThe game auto-loads PNG/WAV assets if present and falls back to built-in procedural visuals when any asset is missing.
WASD/Arrow keys: moveP: pause/resumeRorSpace: restartZ: pick up nearby weapon drop1/2/3: select Arrow/Gun/Capture weaponX: fire selected weapon
python -m unittest discover -s tests -p "test_*.py"ruff check .
black --check .- Cached background surfaces reduce per-frame drawing overhead.
- Collision checks use squared distance math to avoid unnecessary square roots.
- Terrain decoration data is generated on a worker thread so level transitions remain smooth.
- Sprite-sheet extraction is done once on startup, then reused per frame.
- Particle and flash systems are short-lived and capped to maintain stable FPS.
- High score writes are asynchronous to avoid frame hitching.
This project is licensed under the terms in the LICENSE file.