A classic Hangman game with multiple difficulty levels and word categories, built with Python and Pygame.
- Interactive GUI with Pygame
- Multiple difficulty levels (Easy, Medium, Hard)
- Categorized word lists (Animals, Countries, Foods, and more)
- Extensive word database
- Animated hangman progression
- Win/lose detection
- Play again functionality
- Python 3.6 or higher
- Pygame library
- Clone the repository:
git clone https://github.com/kamberasaf/Hangman-Game.git
cd Hangman-Game
- Install the required dependencies:
pip install pygame
- Run the game:
python main.py
- Start the game by pressing any key at the title screen
- Select a difficulty level:
- Easy: 3-5 letter words
- Medium: 6-7 letter words
- Hard: 8+ letter words or words with uncommon letters
- Optionally select a word category (Animals, Countries, Foods, etc.)
- Guess letters by clicking on them with your mouse
- If your guess is correct, the letter will appear in the word
- If your guess is wrong, more of the hangman will be drawn
- Win by guessing all letters in the word before the hangman is complete
- After a game ends, press any key to play again
- Mouse Click: Select a letter or button
- Any Key: Continue at title and game over screens
This game was developed as an introduction to the Pygame library, focusing on:
- Object-Oriented Programming
- Event-driven programming
- Game state management
- UI/UX design
Hangman-Game/
├── assets/ # Game assets
│ ├── fonts/ # Font files
│ ├── images/ # Image files
│ └── wordlists/ # Word lists by category
│ └── categories/ # Categorized word lists
├── src/ # Source code
│ ├── difficulty.py # Difficulty selector
│ ├── game.py # Main game logic
│ └── randomword.py # Word generation
├── .gitignore # Git ignore file
├── LICENSE # License information
├── README.md # This file
└── main.py # Entry point
- Create a new text file in
assets/wordlists/categories/
- Add one word per line (lowercase, no special characters)
- The category will be automatically detected by the game
You can adjust the difficulty criteria in src/randomword.py
:
- Easy: Words with 3-5 letters
- Medium: Words with 6-7 letters
- Hard: Words with 8+ letters or containing uncommon letters (j, q, x, z)
This project is licensed under the MIT License - see the LICENSE file for details.
Created by Asaf Kamber
- Pygame community for the excellent documentation
- OpenGameArt for inspiration on game assets