Skip to content

This repository contains the source code for a classic Snake game implemented in JavaScript. Designed to be lightweight, responsive and customisable, this project is ideal for learning or demonstrating JavaScript programming skills.

License

Notifications You must be signed in to change notification settings

Lane-Romuald/Snake-Game-JavaScript

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Snake Game

A simple Snake game built with JavaScript, HTML, and CSS.

Description

This repository contains the source code for a classic Snake game implemented in JavaScript. The game is designed to be lightweight, responsive, and customizable, making it a great project for learning or showcasing JavaScript programming skills. Players control a snake that grows in size by eating food while avoiding collisions with walls or itself.

Features

  • Classic Snake gameplay.
  • Responsive design for desktop and mobile.
  • Pause Button: Pause the game at any time and resume later.
  • Replay Button: Restart the game instantly to play again.
  • Fruit Consumption: The snake grows by consuming fruits.
  • Score Display: The total score is displayed during gameplay.
  • Fruit Counter: Tracks and displays the number of fruits consumed by type.
  • Random positioning of fruit
  • Background music: There's a background song when the serpet swallows a piece of fruit

Getting Started

Prerequisites

  • A modern web browser .
  • Git (to clone the repository).

Installation

  1. Clone the repository:

    git clone https://github.com/Lane-Romuald/Snake-Game-JavaScript.git
  2. Navigate to the project directory:

    cd snake-game
  3. Open game.html in your browser (preferably Google Chrome, Mozilla Firefox) to play the game.

How to Play

  • Use the arrow keys (or swipe on mobile) to control the snake.
  • Avoid colliding with the walls or yourself.
  • Eat the fruits to grow the snake and increase your score.

File Structure

.
├── index.html      # Main HTML file
├── css/       # Styles files folder
├── js/       # Game logic file folder
├── assets/         # Game assets (images, sounds, etc.)
├── LICENCE         # Licence of Projet
└── README.md       # Project documentation

Contributing

Contributions are welcome! Please follow these steps:

  1. Fork the repository.
  2. Create a new branch: git checkout -b feature-name.
  3. Commit your changes: git commit -m 'Add some feature'.
  4. Push to the branch: git push origin feature-name.
  5. Submit a pull request.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Acknowledgments

  • Inspired by the classic Snake game.
  • Special thanks to all contributors and the JavaScript developer community.

Contact

For questions or feedback, feel free to contact me:

About

This repository contains the source code for a classic Snake game implemented in JavaScript. Designed to be lightweight, responsive and customisable, this project is ideal for learning or demonstrating JavaScript programming skills.

Topics

Resources

License

Stars

Watchers

Forks