In part 5 of the tutorial series eyes are added to the snakes.

Article by Richard Davey. Posted on 7th Aug 2017.   @photonstorm

image

The LoonRide site has been publishing a series of tutorials based on recreating the popular game Slither.io in Phaser. This is part 5 in the series: "In this part of our tutorial series we will be adding eyes to the snake heads. Now let's go over what we want the eyes to do.

Firstly, we need white circles for the back parts of the eyes. These white circles will be locked to the snake heads using a lock constraint. Next, we need black circles for the front parts of the eyes. These black circles will need to stay within the white circles, just so that they can move around like eye pupils. We will keep these black circles near the centers of the white circles using distance constraints, meaning that they can only move a certain distance away from their centers. To make these black circles look towards the mouse pointer, we will apply small forces to them in the direction of the mouse from the head."

Read More