A classic word-guessing game built with HTML, CSS, and JavaScript. Test your vocabulary skills by guessing the hidden word letter by letter before the hangman is fully drawn! The game features a clean interface, dynamic keyboard input, and a variety of words with hints.
Check out the live version here: Hangman Game
- Guess a word by selecting letters from an on-screen keyboard.
- Displays a hint for each word to aid guessing.
- Tracks incorrect guesses with a hangman illustration (up to 6 mistakes).
- Responsive design with a modal for game-over scenarios (win or lose).
- Includes a diverse list of 60+ words with hints.
The game randomly selects a word from a predefined list (word-list.js
). Players guess letters using a virtual keyboard. Correct letters fill in the word, while incorrect guesses advance the hangman drawing. The game ends when the word is fully guessed (victory) or the hangman is completed (loss), showing a modal with the result.
Hangman-Game/
├── index.html # Main HTML file with the game structure
├── style.css # Custom styles for layout and visuals
├── scripts/ # Folder containing JavaScript files
│ ├── script.js # Game logic and interactivity
│ └── word-list.js # List of words and hints
└── README.md # Project documentation
Note: Image assets (e.g., images/hangman-0.svg
, victory.gif
, lost.gif
) are referenced but not provided here. Ensure they are included in an images/
folder for full functionality.
-
Clone the repository:
git clone https://github.com/username/Hangman-Game.git
(Replace
username
with your GitHub username once hosted.) -
Navigate to the project folder:
cd Hangman-Game
-
Ensure image assets are present: Place hangman images (
hangman-0.svg
tohangman-6.svg
) and GIFs (victory.gif
,lost.gif
) in animages/
folder in the root directory. -
Open
index.html
in a browser:- Double-click
index.html
, or - Use a local server (e.g., Live Server in VS Code) for optimal performance:
live-server
- Double-click
To deploy on GitHub Pages:
- Push the project to a GitHub repository.
- Ensure all files (including the
images/
folder) are in the root of the main branch. - Go to Settings > Pages in your repository.
- Set the source to the main branch.
- Access the deployed site at:
https://username.github.io/Hangman-Game/
.
- Open Sans Font - Loaded via Google Fonts for typography.
- Add Words: Edit
word-list.js
to include new words and hints. - Change Images: Replace hangman SVGs or GIFs in the
images/
folder to customize visuals. - Adjust Difficulty: Modify
maxGuesses
inscript.js
(default is 6).
Feel free to fork this repository and submit pull requests with enhancements! Ideas for new features, better styling, or additional word lists are welcome.
This project is open-source and available under the MIT License.