Using finite state machines to model player behaviour and animations.
One thing that's made adding new features really easy in Phaser is using finite-state machines to model behaviour.
In this article, Michael Kelly creates a state class in his project, to model the player's behaviour by assigning them a single "state" to be in.
When the player is in a "state", they can "transition" to another state if a condition is met, which replaces the current state with a new one.
Almost every player animation transition can be backed by a state machine.
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