three JS snake game
By Haoxu Ren (hren3)
Part 1: Display the playing field I initialize a white color play-zone in this project, and the screen shot is as following:
The food, snake can only exists in this white region, and if snake reach the boundary of this region, the game will end, and the final score is your snake’s length.
Part 2: Display and animate snake
The snake is composed by some cube, the initial length of snake is 4, and snake’s head is red, each time the snake eats a food successfully, the snake’s length will plus 1, and the final result is your snake’s length.
Part 3: Add food items and object interactions The food in this project is simply a cube, and this cube’s color is random, everytime is different, once the food ate by snake, there will generate another one at once randomly in the whole play region.
Part 4: Display and interact with non-player snake
The non-player snake is a green head snake, and it will never reach out the boundary, but if your snake reach this NPC snake or reach your own snake, you will die, and the game will end.
The simple demo video is available on : https://youtu.be/HEb-4s46WiQ