This project was created primarily for educational and learning purposes.
While it is well-structured and could technically be used in production, it is not intended for commercialization.
The main goal is to explore and demonstrate best practices, patterns, and technologies in software development.
- Clone the repository
- Go to the repository folder and execute:
python -m venv venv - Execute in Windows:
venv\Scripts\activate - Execute in Linux/Mac:
source venv/bin/activate - Execute:
pip install -r requirements.txt - Execute:
pip install -r requirements.dev.txt - Execute:
pip install -r requirements.test.txt - Use
python app.pyorpython -m srcto execute the program
- Once you're inside the virtual environment, let's install the hooks specified in the pre-commit. Execute:
pre-commit install - Now every time you try to commit, the pre-commit lint will run. If you want to do it manually, you can run the command:
pre-commit run --all-files
StarwardRun is a 2D side-scrolling runner game built in Python using the Pygame library. The player controls a space runner character that must survive an endless wave of incoming obstacles — snails crawling along the ground, bats swooping through the air, and fast-moving grounders that charge across the terrain. The goal is simple: stay alive as long as possible.
Gameplay mechanics:
- Move left and right with
AandD, and jump withSPACEto dodge obstacles. - Survival time is your score — every second you stay alive adds one point.
- As your score grows, new and faster obstacles are introduced, progressively increasing the difficulty.
- Obstacle movement speed scales with your score through defined thresholds, so the longer you survive, the harder it gets.
Power-up system:
- Mystery boxes spawn randomly on the map every 15 to 30 seconds.
- Walking into a mystery box grants one of two powers chosen at random:
- Immunity: the next obstacle collision is completely negated — you pass through it unharmed.
- Killer: the next obstacle you collide with is destroyed instead of ending your run, and a kill sound plays to confirm the elimination.
- Powers last 5 seconds. After the timer expires, the effect wears off and you return to normal.
Progression:
- Snails are available from the start.
- Bats unlock at score 10.
- Grounders unlock at score 20.
- Beyond score 200, obstacles reach their maximum speed of 30 pixels per frame.
Game states:
- The game opens on a waiting screen showing the title and your last score. Press
SPACEto start or restart a run. - A collision with an obstacle while unprotected ends the game immediately, plays the game-over music, and returns to the waiting screen.
Technical highlights:
- Built entirely with Pygame, structured around a sprite-group architecture with
GroupSinglefor the player and power, andGroupfor obstacles. - Environment-aware configuration system supporting
development,production, andtestingmodes via a.envfile. - PyInstaller-compatible asset resolution through a custom
resource_path()helper, enabling distribution as a single standalone executable on Windows, Linux, and Mac. - Comprehensive test suite covering configs, models, constants, helpers, and game logic, all running headless via SDL dummy drivers.
- Python >= 3.11
pygame==2.6.1
python-dotenv==1.0.1
pre-commit==4.3.0
pip-audit==2.7.3
ruff==0.11.12
pytest==8.4.2
pytest-env==1.1.5
pytest-cov==4.1.0
pytest-timeout==2.3.1
pytest-xdist==3.5.0
pyinstaller==6.16.0
https://www.diegolibonati.com.ar/#/project/starward-run
- Go to the repository folder
- Execute:
python -m venv venv - Execute in Windows:
venv\Scripts\activate - Execute in Linux/Mac:
source venv/bin/activate - Execute:
pip install -r requirements.txt - Execute:
pip install -r requirements.test.txt - Execute:
pytest --log-cli-level=INFO
You can generate a standalone executable (.exe on Windows, or binary on Linux/Mac) using PyInstaller.
- Go to the repository folder
- Activate your virtual environment:
venv\Scripts\activate - Install build dependencies:
pip install -r requirements.build.txt - Create the executable:
pyinstaller app.spec
Alternatively, you can run the helper script: build.bat
- Go to the repository folder
- Activate your virtual environment:
source venv/bin/activate - Install build dependencies:
pip install -r requirements.build.txt - Create the executable:
pyinstaller app.spec
Alternatively, you can run the helper script: ./build.sh
You can check your dependencies for known vulnerabilities using pip-audit.
- Go to the repository folder
- Activate your virtual environment
- Execute:
pip install -r requirements.dev.txt - Execute:
pip-audit -r requirements.txt
ENVIRONMENT: Defines the application environment. Acceptsdevelopment,production, ortesting.ENV_NAME: A custom environment variable for template demonstration purposes.
ENVIRONMENT=development
ENV_NAME=template_value
None at the moment.