Project Features
-
Interactive functions implemented by native js
-
ES6 modular development
-
Divided into four classes
- Food Class: generate a food with random position.
- Snake Class: initialize a snake, add one unit of lenth, enable movement and moniter if the sanke is dead.
- Rules Class: set up the speed, score, when to start and end, rules of eating food and hit the wall.
- Entry Class: is like main function in java, rely on rule Class, imported in index.html.
Project’s technology stack
html, CSS, JS
Project source code
For the souce code simply inspect the page.