Skip to content

blackbat13/HungryPigPygameZero

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hungry Pig (Pygame Zero)

A small educational arcade game built with Python and Pygame Zero. Control a pig, collect beetroot to score points, and survive as long as possible without leaving the screen.

Hungry Pig gameplay

Tutorial

This repository accompanies my step-by-step tutorial:

https://edu.cs-htiew.pl/learning-by-games/python/pygame-zero/hungry-pig/

What You Will Learn

  • How to structure a simple Pygame Zero project
  • How to use Actor objects, images, sounds, and fonts
  • How to handle keyboard input and movement
  • How to implement collision detection and scoring
  • How to add game over and restart logic

Gameplay

  • Move the pig to collect beetroot.
  • Each beetroot increases your score and movement speed.
  • If you move outside the game area, it is game over.

Controls

  • Arrow keys: move pig
  • B: toggle bot mode (auto movement toward beetroot)
  • Space: restart after game over

Requirements

  • Python 3.10+ (3.11 recommended)
  • Dependencies from requirements.txt

Installation

pip install -r requirements.txt

Run The Game

pgzrun main.py

Build Executable (Optional)

The included setup.bat builds a Windows executable with PyInstaller:

setup.bat

Project Structure

.
|- main.py
|- requirements.txt
|- setup.bat
|- images/
|- sounds/
|- fonts/

Assets And Credits

License

This project is distributed under the terms of the LICENSE file in this repository.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors