Skip to content

KjellKod/snake

Repository files navigation

Snake Game

Two-player Snake game with neon Flash-era visuals and procedural audio. Built with React, TypeScript, and Vite.

[ --> Play it now <--]

Screenshot 2026-03-13 at 6 59 40 AM

Quick Start

npm install
npm run dev

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

What Each Command Does

  • npm install installs the project dependencies from package.json.
  • npm run dev starts the Vite development server for local development.
  • npm run build creates the production build in dist/ and runs TypeScript checks.
  • npm run preview serves the built dist/ output locally so you can test the production build.

Typical local development flow:

npm install
npm run dev

To verify the production build locally:

npm run build
npm run preview

Controls

Player Up Down Left Right
Player 1 W S A D
Player 2
Mobile Tap above head Tap below head Tap left of head Tap right of head

Click Start to begin. One player dying doesn't end the game — the survivor plays on.

Mobile: Single-player works on mobile — tap anywhere on the canvas relative to the snake's head to steer. The canvas scales to fit your screen.

Scripts

npm run dev      # Start dev server
npm run build    # Production build
npm run preview  # Preview production build
npm test         # Run unit tests

Tech Stack

  • React 18 + TypeScript + Vite
  • Canvas API for rendering (neon glow, particles, screen shake)
  • Web Audio API for procedural sound effects and dynamic background music
  • Vitest for unit testing (58 tests)

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors