GreatTitanDev/Ninja-Game-python
๐ A simple python and pygame 2D endless Ninja runner game. It uses pygame for graphics and sound and python for the logic.
The Ninja - Endless Runner Game
๐ฎ About The Game
The Ninja is an exciting endless runner game built with Python and Pygame that combines fast-paced action with beautiful parallax scrolling visuals. Control a nimble ninja character as you navigate through an endless urban landscape, avoiding obstacles and chasing high scores!
โจ Features
๐ฏ Core Gameplay
- Endless Running - Infinite gameplay with progressively increasing difficulty
- Double Jump Mechanic - Perform mid-air jumps for advanced maneuverability
- Dynamic Speed System - Game speed increases as your score grows
- Health System - Three-hit health system with visual heart indicators
๐จ Visual Excellence
- Parallax Scrolling - Multi-layered background for immersive depth
- Animated Sprites - Smooth character animations for running and jumping
- Pixel-Perfect Graphics - Carefully crafted visual elements
- Dynamic UI - Animated heart icons and real-time score display
๐ Audio Experience
- Background Music - Engaging soundtrack that enhances gameplay
- Sound Effects - Jump, hurt, and game over sound effects
- Audio Management - Dynamic volume control during game states
๐พ Progress & Data
- High Score System - Persistent score saving using JSON
- Real-time Statistics - Live score tracking and best performance display
- Game State Management - Smooth transitions between gameplay and menus
๐น๏ธ How to Play
Basic Controls
- SPACE BAR - Jump (Press again in air for double jump)
Game Rules
- Avoid obstacles by jumping over them
- Each collision reduces your health by one heart
- Game speed increases every 2 points scored
- Maximum speed cap ensures fair gameplay
- Game ends when all hearts are lost
Scoring System
- +1 Point for each successfully avoided obstacle
- Speed Boost every 2 points
- Personal Best tracking with persistent storage
๐ Installation
Prerequisites
- Python 3.6 or higher
- Pygame library
Step-by-Step Setup
-
Clone the Repository
git clone https://github.com/greatitandev/Ninja-Game-python.git cd the-ninja-runner -
Install Dependencies
pip install pygame
-
Verify File Structure
the-ninja-runner/ โโโ main.py โโโ score.json โโโ images/ โ โโโ city/ # Background layers โ โโโ player/ # Character animations โ โโโ obstacle/ # Obstacle variations โ โโโ heart/ # Health indicators โ โโโ bg/ # Menu backgrounds โโโ sound/ โโโ background.mp3 โโโ jump.wav โโโ hurt.wav โโโ hurt1.wav โโโ lose.wav -
Launch the Game
python main.py
๐ฏ Game Screenshots
๐ง Technical Details
Game Architecture
- Object-Oriented Design - Clean class structure for game entities
- Sprite-Based Rendering - Efficient image handling and animation
- Event-Driven Logic - Responsive input handling and game state management
Performance Features
- Frame Rate Control - Consistent 60 FPS gameplay
- Efficient Collision Detection - Rectangle-based collision system
- Memory Management - Proper resource loading and cleanup
File Structure
# Core Classes
Player() # Handles player movement, jumping, and animations
Obstacle() # Manages obstacle generation and movement
# Game Systems
load_sound() # Audio file management
get_score() # High score persistence
save_score() # Progress saving๐ ๏ธ Customization
Easy Modifications
- Difficulty: Adjust
SPEED_INCREMENTandSPEED_INCREASE_RATE - Physics: Modify
JUMP_STRENGTHandGRAVITYconstants - Visuals: Replace image files in respective folders
- Audio: Add new sound files to the sound directory
Adding New Features
The modular code structure makes it easy to add:
- New obstacle types
- Power-ups and collectibles
- Additional character abilities
- New background themes
๐ Troubleshooting
Common Issues
-
Missing Dependencies
pip install --upgrade pygame
-
File Not Found Errors
- Ensure all asset folders are in the correct location
- Check file paths in the code match your directory structure
-
Audio Playback Issues
- Verify audio file formats (WAV, MP3)
- Check system volume and audio drivers
Performance Tips
- Close other applications for optimal performance
- Update graphics drivers if experiencing lag
- Reduce screen resolution if needed
๐จโ๐ป Developer
Nimona Engida - Ethiopian Game Developer
Built with passion for game development and Python programming
About the Developer
- Self-taught young programmer and game developer
- Passionate about creating engaging gaming experiences
- Focus on clean code and user-friendly design
- Ethiopian developer promoting local tech talent
๐ Contributing
We welcome contributions from the community! Feel free to:
- Report bugs and issues
- Suggest new features and improvements
- Submit pull requests with enhancements
- Share your modified versions
Development Guidelines
- Follow PEP 8 coding standards
- Test changes thoroughly before submitting
- Document new features clearly
- Maintain backward compatibility
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
You are free to:
- Use, copy, modify, and distribute the software
- Use for commercial purposes
- Sublicense and sell copies
๐ Acknowledgments
- Pygame Community - For excellent documentation and support
- Open Source Assets - Contributors to free game development resources
- Testers - Everyone who helped refine the gameplay experience
Ready to become the ultimate ninja? Start running now!
"With great speed comes great responsibility... to avoid obstacles!" ๐โโ๏ธ๐จ

