Welcome to the Snake Game developed using java script and css!
This is a simple implementation of the classic Snake Game using JavaScript. The game allows you to control a snake on a grid and eat food to grow longer. Be careful not to collide with the walls or yourself, as it will end the game. The objective is to achieve the highest score possible.
- Use the arrow keys (up, down, left, right) to control the movement of the snake.
- Press any key to start a new game after a game over.
- Snake Movement: Control the snake's movement using the arrow keys.
- Food Generation: Food appears randomly on the grid for the snake to eat.
- Score Tracking: Keep track of the player's score during the game.
- High Score: The highest score achieved is stored and displayed.
- Sound Effects: Enjoy sound effects for eating, game over, high score, and movement.
- Clone or download the project files to your local machine.
- Open the
index.html
file in a web browser. - The game will start automatically, and you can control the snake using the arrow keys.
- Try to eat as much food as possible without colliding with the walls or yourself.
- When the game is over, press any key to start a new game.
You can modify certain aspects of the game by making changes to the code:
- Adjusting Speed: The
speed
variable determines the initial speed of the snake. Increase or decrease its value to change the speed. - Adding Levels: You can introduce different levels or difficulties by adjusting the speed at specific score milestones. Modify the
speed += 0.5;
line inside the score increment condition to change the speed increment and the score threshold. - Changing Sound Effects: Replace the audio files in the
sounds
folder with your own sound effects.
The game should be compatible with modern web browsers that support JavaScript.