- Popular snake game in pure js/html/css no frameworks used.
- compatible with mobile and desktop devices.
- two game modes Easy and Hard
- three diffrent snakes to choose
the whole game is based on three objects: Map, Snake and Point Manager. enriched with several global functions that support menu navigation and setting game parameters before starting it. additionally, in the code we can find the Joystick object that allows us to control on touch devices and the Counter fired before each start of the game
The map is a grid of 16x16px squares. It is generated with the size given by countMapSurface functions
The snake references the map, checking its position after each move, if it has just entered a new square on the map, it adds the previous one to the array called snakeBody. if snakeBody is longer than the current possible length, the last element in array is removed
It is responsible for throwing apples (points) on the map, additionally it counts the points collected by the player and displays them on the screen