Managers
Managers are responsible for managing certain aspects of the game.
Each manager implements the Manager interface which defines the basic manager methods:
These methods are used to pause and resume the game based on the level state. Some managers have an update() or destory() method which are executed in the game loop.
Level Manager
This manager is responsible for managing the phaser instance and switching between scenes. It also has event emitters for communicating with the Vue application.
Entity Manager
The entity manager is responsible for creating and updating entities. It has a update() method which needs to be called in the game loop update cycle. By calling this method, the entity manager will update entities based on this update cycle.
The destory() method is used to clean up the entity manager and all entities.
Camera Manager
The camera manager is responsible for following the player with the camera and updating the parallax background. It has a update() method which needs to be called in the game loop update cycle.
Keyboard Manager
The keyboard manager is responsible for handling keyboard input. It has computed properties which indicate if certain keys are pressed. Some keys have a cooldown which means that the property is only true for one game loop update cycle.
| Property | Cooldown |
|---|---|
leftIsDown | false |
rightIsDown | false |
jumpUpIsDown | false |
jumpDownIsDown | false |
gravityShiftIsDown | true |
interactionKeyIsDown | true |
Sound Manager
The sound manager is responsible for playing sound effects and music.
The sound manager listens to the server's playSound event and plays the sounds.
There are three types of sounds:
- Local sounds: These sounds are only played on the client that triggered the sound.
- Shared sounds: These sounds are sounds that are triggered by one client but need to be played by all clients. This type of sound must be sent to the server with the
playSoundevent. - Server sounds: These sounds are triggered by the server and need to be played by all clients.
Currently, the following sounds are available:
| Sound | Type | Loop |
|---|---|---|
MOOT_LANDING | Shared | false |
BOX_LANDING | Shared | false |
BOX_SLIDING | Shared | true |
MOOT_WALKING | Local | false |
SUCCESS | Server | false |
ATMOSPHERE | Local | true |
MAJORDOM_WALKING | Local | true |
MAJORDOM_LANDING | Shared | false |
GRAVITY_SHIFT | Local | false |
MAJRODOM_DAMAGE | Shared | false |
MOOT_DAMAGE | Shared | false |
TIME_IS_TICKING | Server | false |
TRAPDOOR_OPEN | Server | false |
TRAPDOOR_CLOSE | Server | false |
PRESSUREPLATE_TRIGGER | Shared | false |
PRESSUREPLATE_RELEASE | Shared | false |
Tilemap Manager
The tilemap manager is responsible for loading the tilemap and creating the tilemap layers. It combines rectangular tiles to create larger horizontal collidable areas. Additionally, some tiles must be interpreted as round edges.
See the levels section for more information about the tilemap layer structure.