Skip to content

A classic Snake game enhanced with a menu and settings, built using JavaScript/TypeScript. Control the snake, collect food to grow, and avoid obstacles to win. Features include toggling border collision and customizable controls.

Notifications You must be signed in to change notification settings

lukas60055/Snake-Game-TypeScript

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Snake Game - TypeScript

Hello World TypeScript!

The famous snake game. It was created using JavaScript/TypeScript. The game has been improved with menu and settings. To start the game just press the "Play!" and any snake control button. After getting 'food' we get a point and our snake gets bigger. If the 'Border board' option is turned off in the settings, you can walk through walls. Otherwise we will lose the game. We will also lose when the snake's head hits our body/tail. To win the game, all you have to do is fill in all the fields. This is my first TypeScript project.

Game Controls

  • Control snake:
    • W / ArrowUp -> Up
    • A / ArrowLeft -> Left
    • S / ArrowDown -> Down
    • D / ArrowRight -> Right
  • ESC -> Pause the game. Only works when the game starts.

Setting Game

The following values can be changed in the menu:

  • Speed -> The speed of the snake.
  • Gap size -> Spacing between fields (squares).
  • Field size -> Size in pixels of the field (square).
  • Board size -> Size in pixels of the entire field (board).
  • Color board -> Board color. Two colors like in a checkerboard.
  • Color snake -> The color of the snake and its whole body.
  • Color food -> The color of the food.
  • Border board -> Enables or disables boundaries (walls). If the option is off, you can walk through walls.

Technologies Used

  • HTML
  • CSS/SCSS
  • JavaScript/TypeScript

Installation and Run

1. Clone the repo

git clone https://github.com/lukas60055/Snake-Game-TypeScript

2. Install NPM packages

npm install

3. Build application

npm run build

or

npm run prod

4. Run server/game

npm run server

About

A classic Snake game enhanced with a menu and settings, built using JavaScript/TypeScript. Control the snake, collect food to grow, and avoid obstacles to win. Features include toggling border collision and customizable controls.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published