/pygame-zero-simple-game

Codes and assets for a simple game created with Pygame Zero

Primary LanguagePythonMIT LicenseMIT

๐ŸŽฎ PyGame Zero Simple Game

Python License Made with love

A simple game created using PyGame Zero โ€” a beginner-friendly game framework built on top of Pygame.

This project is perfect for those who are just getting started with game development in Python.

๐Ÿ“ฆ Features

  • ๐ŸŽฎ Simple Gameplay Mechanics: Easy-to-understand core gameplay
  • ๐Ÿ•น๏ธ Player Controls and Movement: Responsive input for smooth character movement
  • ๐Ÿ’ฅ Collision Detection: Detects interactions between game objects
  • ๐Ÿงฎ Score Tracking: Keeps track of the playerโ€™s score during gameplay
  • ๐Ÿพ Sprite Character Animations: Animated character sprites for visual appeal
  • ๐ŸŽต Background Music and Sound Elements: Engaging audio experience during play
  • ๐Ÿ”Š Toggle Background Music: Option to turn on/off background music
  • ๐Ÿ” Basic Game Loop: Core loop handling game updates and rendering

๐Ÿš€ Getting Started

Requirements

Installation

  1. Clone the repository:

    git clone https://github.com/davutbayik/pygame-zero-simple-game.git
    cd pygame-zero-simple-game
    
  2. Create and activate a virtual environment (Optional-Recommended):

    python -m venv .venv
    source .venv/bin/activate  # On Windows: .venv\Scripts\activate
    
  3. Install the required packages:

    pip install -r requirements.txt
    
  4. Run the game:

     pgzrun game.py
    

๐Ÿ•น Controls

Key Action
Arrow Keys Move player
Space Attack

๐Ÿง  How It Works

This game uses PyGame Zero, a beginner-friendly library that simplifies writing games in Python.

The core structure includes:

  • draw() โ€” Renders game elements on the screen every frame.
  • update() โ€” Updates game logic like movement, collisions, or score.
  • Assets (like images and sounds) are loaded automatically from the images/ and sounds/ folders, based on filenames.

You define actors (e.g., the player or enemies) using Actor() and control them using keyboard input. PyGame Zero manages the game loop behind the scenes.

๐ŸŽฏ Goals

The primary goals of this project are:

  • โœ… Demonstrate how to build a simple 2D game using Python and PyGame Zero
  • โœ… Provide a hands-on learning example for beginners in game development
  • โœ… Encourage experimentation by using a clean and minimal code structure
  • โœ… Offer a starting point to expand with more features

๐Ÿ› ๏ธ Customize

Feel free to customize and expand the game! Some ideas include:

  • ๐ŸŽจ Add more levels or scenes
  • ๐Ÿง  Add simple AI for enemies
  • ๐Ÿ† Create a high score table
  • ๐ŸŒŽ Add support for different screen sizes or full-screen mode

Let your imagination guide you โ€” itโ€™s a great way to practice Python while having fun!

๐Ÿ–ผ In-Game Screenshots

The images below shows in game screenshots from start menu and game loop.

Start Menu

Core loop

๐Ÿค Contributing

Contributions are welcome and appreciated! If youโ€™d like to improve this project, hereโ€™s how you can help:

  • ๐Ÿž Report bugs or issues.
  • ๐ŸŒŸ Suggest new features or improvements.
  • ๐Ÿ”€ Fork the repo, make your changes, and submit a pull request.

Please make sure your code follows best practices and includes proper documentation where necessary.

๐Ÿ“„ License

This project is licensed under the terms of the MIT License.
You are free to use, modify, and distribute this software as long as you include the original license.

๐Ÿ“ฌ Contact

Made with โค๏ธ by Davut Bayฤฑk โ€” feel free to reach out via GitHub for questions, feedback, or collaboration ideas.


โญ If you found this project helpful, consider giving it a star!