- Psykick2D
Layer
A layer houses a set of systems which are updated/drawn on each frame
new Layer(
options
)
Parameters
options | Object | ||
options.id | number | Unique ID assigned by the World | |
options.container | Element | Element which houses the Layer | |
options.serverMode | boolean | If true, a canvas will not be made | false |
Properties
id | number | ||
container | Element | ||
camera | |||
renderSystems | ARRAY | [] | |
behaviorSystems | ARRAY | [] | |
active | boolean | true | |
canvas | document.createElement() | ||
_serverMode | boolean | private | false |
stage | new PIXI.Stage() | ||
scene | new PIXI.DisplayObjectContainer() | ||
renderer | PIXI.autoDetectRenderer() | ||
visible | boolean | true |
Methods
removeCanvas( )
Removes the canvas to ensure no additional drawing is done
restoreCanvas( )
Puts the layers canvas back in the container if it was removed
setZIndex( )
Set the depth layer index
zIndex | number |
addSystem( )
Add a new system to the layer
system | System |
removeSystem( )
Removes a system from the layer
system | System |
addEntity( )
Will attempt to add an entity to every system
entity | Entity |
removeEntity( )
Will attempt to remove an entity from every system
entity | Entity |
safeRemoveEntity( )
Will attempt to safely remove an entity from every system
entity |
draw( )
Draw the layer
delta | number | Time since previous update |
update( )
Update the layer
delta | number | Amount of time since the last update |