This is a Hangman game implemented in Python using the Pygame library. The game includes features such as guessing letters, a hangman figure, win/lose conditions, and animation effects.
- Python 3.x
- Pygame library
-
Clone the repository:
git clone https://github.com/jusot99/Game/HangmanGame.git cd HangmanGame
-
Install the required dependencies:
pip install pygame
Run the following command to start the Hangman game:
python main.py
- Objective: Guess the word correctly by inputting letters while avoiding exceeding the maximum attempts allowed.
- Controls:
- Type a letter to guess.
- Press 'r' to restart the game.
- Press 'q' to quit the game.
- Press 'a' to start an animation (feature-dependent).
The code is organized as follows:
-
Initialization:
- Pygame and game variables are set up.
- Word lists, fonts, and animation variables are defined.
-
Main Game Loop:
- Handles user input for guessing letters, restart, quit, and animation triggers.
- Manages window resizing events.
-
Drawing the Hangman:
- Draws the hangman figure based on the number of incorrect attempts.
-
Drawing the Word:
- Displays the word with blanks and guessed letters.
- Checks for win or lose conditions.
-
User Interaction:
- Displays information about guessed letters, attempts left, and the word database.
-
Word Database:
- Custom words can be added to the database for the game.
-
Animation:
- An optional animation can be triggered during specific events.
- Guess letters to uncover the word.
- Hangman figure drawn based on incorrect attempts.
- Win and lose conditions with appropriate messages.
- Restart and quit options.
- Animation effects during specific events.
Feel free to customize the game by adjusting parameters such as window size, colors, or adding new features.
This Hangman game is released under the MIT License.
- The Pygame community for providing a versatile library for game development.
Enjoy playing the Hangman game!