This project is a 2D Platformer game developed using the Pygame Zero framework and Object-Oriented Programming (OOP) principles.
Considering the constraints specified in the project requirements (specifically the 100-200 line limit), the project architecture is presented in two distinct versions.
There are two executable Python files in the project directory. For the evaluation phase, please consider the main.py file, which strictly adheres to all constraints.
This is the optimized main version (~176 lines) tailored to fully comply with the 100-200 line constraint requested in the project guidelines.
- Scope: It fully implements all required core mechanics (gravity, platform collisions, enemy patrols, win/lose mechanics, and sprite animations).
- Interface: It features only the requested core Main Menu buttons (Start Game, Toggle Sound, Exit).
- Architecture: By utilizing Python's Tuple Unpacking feature, a vertically compact structure is achieved without sacrificing code readability.
This is the full version containing extra user interface (UI) features that had to be omitted from the main code due to the line count constraint.
- Added Features: In addition to the base version, it includes an in-game Pause Menu, a Confirm Exit Screen to prevent accidental data loss between states, and manual background decoration drawings.
- Purpose: It is included in the project as a "Bonus" to demonstrate how additional state modules and UI elements can be seamlessly integrated on top of the core game engine architecture.
- Left Arrow / Right Arrow: Move left and right
- Up Arrow: Jump
Project dependencies are strictly limited according to the given rules. The codebase does not contain any unauthorized external libraries.
- Python 3.x
pgzrun(Pygame Zero)randompygame(Only theRectclass is imported)
To run the game:
pgzrun main.py