Pixeljs

A simple and flexible HTML5 and JavaScript powered game engine.

View Project on GitHub Download Pixel.js (v0.9b)

Layer Class

Represents a game scene layer.

Inheritance Hierarchy

  • Layer

Properties

Name Description
engine The Engine that the layer belongs to.
redraw A boolean value indicating whether or not the layer should be redrawn when the next frame is rendered.
static A boolean value indicating whether or not the layer is static and should only be drawn once.
visible A boolean value indicating whether or not the layer is visible.
zIndex The z-index of the layer.

Methods

Name Description
addComponent Add a component that extends or shares the same interface as an Entity.
createEntity Create and register a new Entity.
draw Draw the layer and all its components to the screen.
drawFromCanvas Draw an image from a HTML5 canvas to the layer.
drawImage Draw an image to the layer.
drawText Draw text on the layer.
load Load all the components registered to the layer.
registerCollidable Register a collidable Entity.
update Call the update method for all the registered components.

Remarks

Layers are used to encapsulate game entities and components with the purpose of building the game scene.

Supported Platforms

Google Chrome, Mozilla FireFox, Internet Explorer 9+, Opera, Safari.