Skip to content

torielstrom/snake

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

Retro Snake Game

A classic Snake game built with vanilla JavaScript, HTML5 Canvas, and CSS. Features a retro arcade aesthetic with customizable difficulty levels.

Features

  • Classic Snake Gameplay - Navigate the snake to eat food and grow longer
  • Three Difficulty Levels - Easy, Medium, and Hard speeds
  • Retro Design - Green monochrome display reminiscent of classic arcade games
  • Responsive Controls - Smooth arrow key navigation with scroll prevention
  • Score Tracking - Track your points as you collect food
  • Start/Restart Button - Control when to begin or restart the game

How to Play

  1. Open index.html in your web browser
  2. Select your difficulty level (Easy, Medium, or Hard)
  3. Click "Start Game" to begin
  4. Use arrow keys to control the snake:
    • ↑ Arrow Up - Move up
    • ↓ Arrow Down - Move down
    • ← Arrow Left - Move left
    • → Arrow Right - Move right
  5. Collect red food blocks to grow and increase your score
  6. Avoid hitting walls or your own tail
  7. Click "Restart" to play again after game over

Game Rules

  • Each food item collected adds 10 points to your score
  • The snake grows longer with each food item eaten
  • The game ends if you hit a wall or collide with yourself
  • You cannot immediately reverse direction (e.g., can't go directly from moving right to left)

Technical Details

  • Built with pure vanilla JavaScript - no frameworks or libraries required
  • HTML5 Canvas for rendering
  • CSS3 for styling and animations
  • Fully self-contained in a single HTML file

Installation

No installation required! Simply:

  1. Clone this repository or download the index.html file
  2. Open index.html in any modern web browser
  3. Start playing!
git clone [your-repo-url]
cd snake
open index.html  # On Mac
# OR
start index.html  # On Windows
# OR
xdg-open index.html  # On Linux

Browser Compatibility

Works on all modern browsers including:

  • Chrome
  • Firefox
  • Safari
  • Edge

License

This project is open source and available under the MIT License.

Contributing

Contributions are welcome! Feel free to:

  • Report bugs
  • Suggest new features
  • Submit pull requests

Future Enhancements

Potential features for future versions:

  • High score tracking with local storage
  • Mobile touch controls
  • Power-ups and special food items
  • Multiple game modes
  • Multiplayer support
  • Sound effects and background music

Author

The Charmizard

Acknowledgments

Inspired by the classic Snake game that appeared on Nokia phones in the late 1990s.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages