Welcome to the Snake Game! This classic arcade game has been recreated using HTML, CSS, and JavaScript. Control the snake to eat apples, grow longer, and achieve the highest score possible. This README provides a comprehensive guide to understanding, setting up, and playing the game.
Project Overview
The Snake Game is a simple yet addictive game where the player controls a snake to eat apples appearing randomly on the screen. Each time the snake eats an apple, it grows longer, and the game's difficulty increases by speeding up the snake. The objective is to achieve the highest possible score without colliding with the walls or the snake's own body.
Features
Responsive Design: The game is centered and adapts to different screen sizes.
Keyboard Controls: Use arrow keys or WASD to navigate the snake.
Touch Controls: Swipe gestures for mobile device compatibility.
Sound Effects: Play a sound when the snake eats an apple.
Score Tracking: Displays current score and high score, with high score saved in local storage.
Dynamic Difficulty: Snake speed increases as the score increases.
Game Over Screen: Displays score and high score with an option to restart.
Technologies Used
HTML5: Structure of the game interface.
CSS3: Styling and layout.
JavaScript (ES6): Game logic and interactivity.
Canvas API: Rendering the game graphics.
Local Storage: Saving high scores.
How to Play
Start the Game
Click on the canvas area or tap on mobile devices to start the game. Control the Snake
Keyboard:
Up: Arrow Up or W
Down: Arrow Down or S
Left: Arrow Left or A
Right: Arrow Right or D
Touch (Mobile Devices):
Swipe in the desired direction to change the snake's movement.
Objective
Navigate the snake to eat red apples appearing on the screen.
Each apple eaten increases the snake's length and the score.
Avoid colliding with the walls or the snake's own body.
Game Over
When the snake collides with a wall or itself, the game ends.
The game over screen displays your score and the high score.
Click or tap to restart the game.