This is a classic Hangman game developed in Python using the Pygame library. The game randomly selects a secret word from a text file, and the player has to guess the word letter by letter within a limited number of attempts.
- Python: The core programming language used for the game logic.
- Pygame: A cross-platform set of Python modules designed for writing video games.
jogo_da_forca.py: The main entry point of the application. It contains the primary game loop, handles user input, and manages the overall game state.funcoes.py: This file contains helper functions for the game, including:- Functions to draw the hangman figure.
- A function to select a random word from the
palavras_secretas.txtfile. - Functions to manage the game's logic, such as camouflaging the secret word and tracking the player's attempts.
palavras_secretas.txt: A text file that stores the secret words and their corresponding hints. The format for each line isWORD;HINT.requirements.txt: This file lists the project's dependencies. In this case, it only containspygame.
To run this project, you need to have Python and pip installed.
-
Install dependencies:
pip install -r requirements.txt
-
Run the game:
python jogo_da_forca.py
- The code is written in Portuguese.
- The
palavras_secretas.txtfile can be easily modified to add or change the secret words and hints. The format is one word and hint per line, separated by a semicolon (e.g.,PYTHON;PROGRAMMING LANGUAGE).