A modern implementation of the classic Snake game with arcade-style visuals and enhanced gameplay features.
You can play the game by running:
npm run dev
And opening the provided local URL in your browser.
- 🎯 Classic snake gameplay with modern visuals
- 🌟 Glowing effects and visual animations
- 📱 Mobile support with touch controls and swipe gestures
- 🏆 High score tracking with local storage
- ⏸️ Pause functionality (press 'P' or double-tap on mobile)
- 🚀 Progressive difficulty (snake speeds up as you score more points)
- 👁️ Visual feedback when eating food
- 🎨 Retro arcade-style design with pixel font
- Arrow Keys: Control snake direction
- P: Pause/Resume game
- Swipe: Control snake direction
- On-screen buttons: Directional controls
- Double tap: Pause/Resume game
- Vanilla JavaScript
- HTML5 Canvas for rendering
- CSS for styling
- Vite for development and building
src/game.js
- Core game logic and renderingmain.js
- Game initialization and input handlingstyle.css
- Game stylingindex.html
- Main HTML structure
- Node.js (v14 or later recommended)
- npm or yarn
- Clone the repository:
git clone https://github.com/yourusername/snake-game.git
cd snake-game
- Install dependencies:
npm install
- Start the development server:
npm run dev
- Open your browser and navigate to the provided local URL (usually http://localhost:5173)
To create a production build:
npm run build
The built files will be in the dist
directory.
- The snake moves continuously in the current direction
- Eating food increases the snake's length and your score
- The game ends if the snake hits the wall or itself
- Every 50 points, the snake's speed increases
- Your high score is saved between sessions
The game uses HTML5 Canvas for rendering with a game loop that:
- Updates the snake position based on current direction
- Checks for collisions with walls, self, and food
- Updates the score and snake length when food is eaten
- Renders the game state with visual effects
This project is licensed under the MIT License - see the LICENSE file for details.
- Font: "Press Start 2P" from Google Fonts
- Inspired by the classic Snake game from Nokia phones