AbdullahIsmail2 / snake-game

classical snake game featuring a simple ui and developed algorithmically

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Snake Game

Description

This is a classical Snake game implemented using vanilla JavaScript, HTML, and CSS. The game features a snake that grows longer as it consumes food while avoiding collision with walls and itself.

JavaScript Topics Covered

  • Event handling for keyboard input
  • DOM manipulation for updating game elements
  • Game loop implementation for controlling game logic
  • Collision detection algorithms
  • Array manipulation for managing the snake's body
  • Random generation of food items
  • Score tracking

Features

  • Snake movement controlled by arrow keys
  • Random generation of food items
  • Collision detection with walls and the snake itself
  • Score tracking
  • Game over detection

Installation

  1. Clone the repository:

  2. Open index.html in your web browser to play the game.

  3. git clone https://github.com/AbdullahIsmail2/snake-game

Usage

  • Use the arrow keys (up, down, left, right) to control the snake's movement.
  • The snake will consume food items and grow longer.
  • Avoid collision with walls and the snake's own body.
  • The game ends when the snake collides with a wall or itself.

Files Included

  • index.html: HTML file containing the game layout and structure.
  • style.css: CSS file for styling the game elements.
  • script.js: JavaScript file containing the game logic and functionality.

Credits

  • This game is inspired by the classic Snake game.

About

classical snake game featuring a simple ui and developed algorithmically


Languages

Language:JavaScript 61.3%Language:CSS 25.1%Language:HTML 13.7%