Skip to content

๐ŸŽ‡ A simple python and pygame 2D endless Ninja runner game. It uses pygame for graphics and sound and python for the logic.

License

Notifications You must be signed in to change notification settings

GreatTitanDev/Ninja-Game-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

12 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

The Ninja - Endless Runner Game

Python Version Pygame Version Game Genre Project Status License

The Ninja Gameplay

๐ŸŽฎ 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

  1. Avoid obstacles by jumping over them
  2. Each collision reduces your health by one heart
  3. Game speed increases every 2 points scored
  4. Maximum speed cap ensures fair gameplay
  5. 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

  1. Clone the Repository

    git clone https://github.com/greatitandev/Ninja-Game-python.git
    cd the-ninja-runner
  2. Install Dependencies

    pip install pygame
  3. 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
    
  4. Launch the Game

    python main.py

๐ŸŽฏ Game Screenshots

Gameplay Game Over
Gameplay Game Over

๐Ÿ”ง 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_INCREMENT and SPEED_INCREASE_RATE
  • Physics: Modify JUMP_STRENGTH and GRAVITY constants
  • 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

  1. Missing Dependencies

    pip install --upgrade pygame
  2. File Not Found Errors

    • Ensure all asset folders are in the correct location
    • Check file paths in the code match your directory structure
  3. 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:

  1. Report bugs and issues
  2. Suggest new features and improvements
  3. Submit pull requests with enhancements
  4. 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!" ๐Ÿƒโ€โ™‚๏ธ๐Ÿ’จ

Made in Ethiopia Technology

About

๐ŸŽ‡ A simple python and pygame 2D endless Ninja runner game. It uses pygame for graphics and sound and python for the logic.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages