Constructor
new Player(config)
- Source:
- See:
Constructs the player, gives it a physics body, selects a random Discord avatar to use as the image.
Parameters:
| Name | Type | Description | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| config | Object | The configuration object Properties
 | 
Extends
- Phaser.GameObjects.Image
Methods
(static) preload()
- Source:
Preloads assets needed for player. Currently only looks to 'images/discord-avatars.png' and 'atlas/discord-avatars.json' for player image data. Picks a random avatar from the Phaser.Scene each time the game is run.
See Phaser docs for more info about atlases.
Parameters:
| Name | Type | Description | 
|---|---|---|
| config.scene | Phaser.Scene | The Phaser.Scene doing the pre-loading. | 
die()
- Source:
- To Do:
- 
        - Set up a death animation, event handling
 
Player death. Currently immediately stops the scene and starts gameover. Should instead unhook controls and fire a player death event.
Fires:
move(direction)
- Source:
Applies velocity to the player, such as in response to keyboard input
Parameters:
| Name | Type | Description | 
|---|---|---|
| direction | string | One of "e","w","s","n" |