This is a simple Snake game implemented in JavaScript. The game allows the player to control a snake and eat candies to grow longer. The objective is to avoid colliding with the snake's own body.
The project has the following files:
-
script.js: This file contains the JavaScript code for the Snake game. It includes the implementation of the game logic, snake movement, food generation, and candy generation. It exports the necessary functions and classes to run the game. -
index.html: This file is the HTML file that serves as the entry point of the game. It includes the necessary HTML structure and links to the CSS and JavaScript files. -
style.css: This file contains the CSS styles for the game. It defines the appearance and layout of the game elements.
To run the Snake game, follow these steps:
-
Clone the repository or download the project files.
-
Open the
index.htmlfile in a web browser.
The game starts immediately when you load the page. The snake moves in the direction of the arrow keys. The goal of the game is to eat as many candies as possible without colliding with the snake's own body.
Each time the snake eats an apple, it grows longer and the game speed increases. The game ends when the snake collides with its own body.
Enjoy playing the Snake game!