In the next part, collision detection with the spikes is added using line collision instead of physics.
From Emanuele Feronato: "Time to update the Phaser version adding collision detection. Yesterday in the Unity version of the prototype I wrote a script which forgives a lot of player errors, actually checking for collisions between the player and a single point of each spike.
Phaser version will be harder, because I will be checking shape collision between the player and the spikes.
How can we check for shape collision without physics? There won’t be any “shape” collision, we are going to check for line segment Vs circle like I did in this example.
There are only two sides of each triangle which can collide with the circle, and I am showing you when to check for collision by painting them red in this prototype:"
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