new Plugin(game, parent)
This is a base Plugin template to use for any Phaser plugin development.
Callbacks
add | active | visible | remove |
---|---|---|---|
init | |||
preUpdate* | |||
update* | render* | ||
postUpdate* | postRender* | ||
destroy |
Update and render calls are repeated (*).
Parameters:
Name | Type | Description |
---|---|---|
game |
Phaser.Game | A reference to the currently running game. |
parent |
any | The object that owns this plugin, usually Phaser.PluginManager. |
- Source:
- src/core/Plugin.js line 27
Classes
Members
-
active : boolean
-
A Plugin with active=true has its preUpdate and update methods called by the parent, otherwise they are skipped.
Type:
- boolean
- Source:
- src/core/Plugin.js line 46
-
game : Phaser.Game
-
A reference to the currently running game.
Type:
- Source:
- src/core/Plugin.js line 35
-
hasPostRender : boolean
-
A flag to indicate if this plugin has a postRender method.
Type:
- boolean
- Source:
- src/core/Plugin.js line 82
-
hasPostUpdate : boolean
-
A flag to indicate if this plugin has a postUpdate method.
Type:
- boolean
- Source:
- src/core/Plugin.js line 70
-
hasPreUpdate : boolean
-
A flag to indicate if this plugin has a preUpdate method.
Type:
- boolean
- Source:
- src/core/Plugin.js line 58
-
hasRender : boolean
-
A flag to indicate if this plugin has a render method.
Type:
- boolean
- Source:
- src/core/Plugin.js line 76
-
hasUpdate : boolean
-
A flag to indicate if this plugin has an update method.
Type:
- boolean
- Source:
- src/core/Plugin.js line 64
-
parent : any
-
The parent of this plugin. If added to the PluginManager the parent will be set to that, otherwise it will be null.
Type:
- any
- Source:
- src/core/Plugin.js line 40
-
visible : boolean
-
A Plugin with visible=true has its render and postRender methods called by the parent, otherwise they are skipped.
Type:
- boolean
- Source:
- src/core/Plugin.js line 52
Methods
-
destroy()
-
Clear down this Plugin and null out references
- Source:
- src/core/Plugin.js line 124
-
postRender()
-
Post-render is called after the Game Renderer and State.render have run. It is only called if visible is set to true.
- Source:
- src/core/Plugin.js line 115
-
preUpdate()
-
Pre-update is called at the very start of the update cycle, before any other subsystems have been updated (including Physics). It is only called if active is set to true.
- Source:
- src/core/Plugin.js line 88
-
render()
-
Render is called right after the Game Renderer completes, but before the State.render. It is only called if visible is set to true.
- Source:
- src/core/Plugin.js line 106
-
update()
-
Update is called after all the core subsystems (Input, Tweens, Sound, etc) and the State have updated, but before the render. It is only called if active is set to true.
- Source:
- src/core/Plugin.js line 97