Skip to content

TwitchCaptain/hangman

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

8 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🎭 Hangman Game

A fully-featured Hangman word guessing game built with Svelte and TypeScript. Features beautiful dark-mode UI, animations, multiple difficulty levels, word categories, and a GitHub Pages deployment workflow.

✨ Features

  • Multiple Difficulty Levels β€” Easy (8 wrong), Medium (6 wrong), Hard (4 wrong)
  • Word Categories β€” Animals, Countries, Movies, Food, Science, or random
  • SVG Hangman Figure β€” Animated body parts that appear with each wrong guess
  • On-screen Keyboard β€” Click letters or use your physical keyboard
  • Letter Animations β€” Pop animations for correct guesses, shake for wrong ones
  • Word Display β€” Animated letter slots with flip effects
  • Win/Lose Detection β€” With celebratory confetti on winning
  • Score Tracking β€” Persistent stats during the session
  • Responsive Design β€” Works on desktop and mobile
  • Dark Theme β€” Modern dark UI with accent colors
  • Reusable Components β€” LetterTile, WordDisplay, Keyboard, HangmanFigure, GameStatus, GameSettings

πŸš€ Getting Started

Prerequisites

  • Node.js 18+
  • npm

Install

npm install

Development

npm run dev

Open http://localhost:5173 in your browser.

Build

npm run build

Output goes to dist/.

Preview Production Build

npm run preview

πŸ“¦ Deployment

GitHub Pages (via GitHub Actions)

The included workflow (.github/workflows/deploy.yml) automatically builds and deploys to GitHub Pages whenever you push to main or master.

  1. Push your repo to GitHub
  2. Go to Settings > Pages and set the source to GitHub Actions
  3. Push to main β€” the action will deploy to gh-pages automatically

Manual Deploy (gh-pages branch)

npm run deploy

This builds the project and pushes the dist/ folder to the gh-pages branch using gh-pages.

🧩 Project Structure

hangman/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ main.ts              # Entry point
β”‚   β”œβ”€β”€ App.svelte            # Main application component
β”‚   └── lib/
β”‚       β”œβ”€β”€ types.ts          # TypeScript types and word data
β”‚       β”œβ”€β”€ gameLogic.ts      # Game state management
β”‚       β”œβ”€β”€ HangmanFigure.svelte  # SVG hangman figure
β”‚       β”œβ”€β”€ LetterTile.svelte     # Reusable letter button
β”‚       β”œβ”€β”€ WordDisplay.svelte    # Word letter display
β”‚       β”œβ”€β”€ Keyboard.svelte       # On-screen keyboard
β”‚       β”œβ”€β”€ GameStatus.svelte     # Win/lose status card
β”‚       └── GameSettings.svelte   # Difficulty/category controls
β”œβ”€β”€ public/
β”‚   └── index.html
β”œβ”€β”€ .github/workflows/
β”‚   └── deploy.yml            # GitHub Pages deploy workflow
β”œβ”€β”€ package.json
β”œβ”€β”€ vite.config.ts
β”œβ”€β”€ svelte.config.js
β”œβ”€β”€ tsconfig.json
└── README.md

πŸ› οΈ Built With

  • Svelte β€” Reactive UI framework
  • TypeScript β€” Type-safe JavaScript
  • Vite β€” Fast build tool
  • gh-pages β€” Deploy to GitHub Pages

πŸ“„ License

MIT

About

🎭 Hangman word guessing game built with Svelte + TypeScript

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages