Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Snake Game

A classic Snake game built with vanilla JavaScript, HTML5 Canvas, and CSS3. Features a modern neon aesthetic, responsive design, and mobile touch controls.

Play the Game

Features

  • Score Tracking - Current score and high score saved to localStorage
  • Progressive Difficulty - Speed increases as you eat more food
  • Pause/Resume - Pause anytime with spacebar or the pause button
  • Mobile Support - Swipe gestures and on-screen touch controls
  • Responsive Design - Adapts to any screen size
  • Modern Visuals - Neon glow effects, smooth animations, and a polished UI
  • Accessibility - Respects prefers-reduced-motion setting

How to Play

Controls

Platform Action
Desktop Use W A S D or Arrow keys to move
Desktop Press Space to pause/resume
Mobile Swipe in any direction to move
Mobile Use on-screen buttons to move
Mobile Tap the PAUSE button to pause

Rules

  1. Guide the snake to eat the red food pellets
  2. Each food eaten increases your score by 10 points
  3. The snake grows longer with each food eaten
  4. Avoid hitting the walls or the snake's own body
  5. The game speeds up as your score increases

Project Structure

snake-game/
├── index.html      # Main HTML file
├── css/
│   └── styles.css  # All styling and animations
├── js/
│   └── game.js     # Game logic and controls
├── README.md       # This file
└── .gitignore      # Git ignore rules

Local Development

  1. Clone the repository:

    git clone https://github.com/oranshabatcohen/snake-game.git
  2. Open index.html in your browser, or use a local server:

    # Using Python
    python -m http.server 8000
    
    # Using Node.js
    npx serve
  3. Visit http://localhost:8000

Deployment to GitHub Pages

  1. Push this repository to GitHub

  2. Go to your repository's Settings > Pages

  3. Under "Source", select Deploy from a branch

  4. Select the main branch and / (root) folder

  5. Click Save

  6. Your game will be live at https://oranshabatcohen.github.io/snake-game/

Browser Support

  • Chrome (latest)
  • Firefox (latest)
  • Safari (latest)
  • Edge (latest)
  • Mobile browsers (iOS Safari, Chrome for Android)

Technologies Used

  • HTML5 Canvas - Game rendering
  • CSS3 - Styling, animations, and responsive design
  • Vanilla JavaScript - Game logic with no dependencies
  • localStorage - High score persistence
  • Google Fonts - Inter font family

License

MIT License - feel free to use this project for learning or as a base for your own games.

About

Classic Snake in vanilla JS + HTML5 Canvas. Neon aesthetic, progressive difficulty, mobile swipe controls. Playable in browser.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages