Game

Snake

Snake is a video game where the player maneuvers a growing line that becomes a primary obstacle to itself.

Overview

A quick look at general information about the project with a brief description of the development process.

Project

The main goal was to implement old-time classic Snake with vanilla JavaScript. The focus was on delivering game mechanics(movement, collision detection, changing states of the game) with JavaScript tools. Development environment built with Webpack, version control with git(both first time).

Project difficulties

Most challenges were caused by the idea of creating a game. JavaScript is a language that uses a browser (V8) to execute the code and it is not optimized for creating game engines.

Solutions

For drawing graphics, I used canvas API, for the game loop requestAnimationFrame method. Animation and movement were based on the browser refresh rate. The level generator was made as an instance of a class representing an object-oriented approach. For the development environment, I used the basic configuration of Webpack, following their documentation.

Notable features

  • State machine.

  • Game loop based on browser refresh rate.

  • Map generator from given string.

  • Collision detection mechanism.

Tech stack

  • HTML

  • JavaScript

GET IN TOUCH

Contact

Want to reach out about a project, collaboration, or just want to say friendly hello?

Message not send