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.
- 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
- Node.js 18+
- npm
npm installnpm run devOpen http://localhost:5173 in your browser.
npm run buildOutput goes to dist/.
npm run previewThe included workflow (.github/workflows/deploy.yml) automatically builds and deploys to GitHub Pages whenever you push to main or master.
- Push your repo to GitHub
- Go to Settings > Pages and set the source to GitHub Actions
- Push to
mainβ the action will deploy togh-pagesautomatically
npm run deployThis builds the project and pushes the dist/ folder to the gh-pages branch using gh-pages.
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
- Svelte β Reactive UI framework
- TypeScript β Type-safe JavaScript
- Vite β Fast build tool
- gh-pages β Deploy to GitHub Pages
MIT