Skip to content

nwe2107/Mini-Golf-Game

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mini Golf Game (pygame)

Side-view mini golf with moving gator hazards built with pygame. Launch the script to play, or package it as a double-clickable executable.

Get the code

  • Clone or download this repository, then open a terminal in its root (folder containing golf.py and requirements.txt).
  • Example clone:
git clone <repo-url> mini-golf-game
cd mini-golf-game

Requirements

  • Python 3.9 or newer
  • pip
  • Runtime dependency: pygame (pinned in requirements.txt)
  • Packaging dependency (optional): pyinstaller

Setup and run

python3 -m venv .venv
source .venv/bin/activate      # Windows: .venv\Scripts\activate
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
python golf.py                 # Windows may need: python -m golf

Controls

  • Mouse drag on the ball: aim and set power; release to shoot.
  • F: fast-forward simulation to where the ball will rest.
  • R: reset the ball to the tee (no penalty).
  • N / P: next / previous level.
  • Enter: advance after sinking a hole.
  • Esc: quit.
  • Avoid gator mouths; getting chomped adds a penalty stroke.

Build a clickable executable (PyInstaller)

  1. Install PyInstaller inside the activated virtual environment:
python -m pip install pyinstaller
  1. Build a windowed, single-file executable:
pyinstaller --name MiniGolf --windowed --onefile golf.py
  1. The build artifacts land in dist/:
    • Windows: dist/MiniGolf.exe (double-click to run)
    • macOS/Linux: dist/MiniGolf (binary) and, on macOS, an .app bundle

Re-run the PyInstaller command after code changes. Delete build/ and dist/ if you want a clean rebuild.

Notes

  • The game is self-contained (no external assets). If the window fails to open on macOS, ensure you are using a Python build with GUI support (python.org installer or recent Homebrew Python).
  • For troubleshooting PyInstaller on Windows, run the command from Developer Command Prompt to ensure build tools are on PATH.

About

Mini-Golf-Game

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages