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

Posted on 7th Aug 2017. Follow @phaser_ and get the Phaser World newsletter.

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


The first book on the creation of HTML5 cross platform games using Phaser 3 and other free software.
  • By Emanuele Feronato
  • 155 Pages
  • 28 Source Code Examples
  • Build a complete game from start to finish
  • Cross Platform
  • Scaling for devices
Buy Now
$19