Pixeljs

A simple and flexible HTML5 and JavaScript powered game engine.

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

Engine Class

Provides the functionality required to hook into various events, register components and control the game loop.

Inheritance Hierarchy

  • Engine

Properties

Name Description
deltaTime The time in milliseconds that has passed since the last iteration of the game loop.
displayFPS A boolean value indicating whether or not the built-in FPS counter should be displayed.
fullscreen A boolean value indicating whether or not fullscreen mode should be enabled.
maxDeltaTime The maximum amount of time in milliseconds that should be applied when calculating the time between iterations of the game loop.
scene An object that encapsulates information relating to the game scene.

Methods

Name Description
addSound Add a Sound to the collection of registered Sound components.
createLayer Creates and registers a new Layer.
createSound Creates and registers a new Sound.
init Initialises the game scene.
loadAndRun Loads all registered components that have been prepared and then runs the game loop.
loadScene Loads the prepared components in the layers that are contained within the current scene.
loadSounds Loads the prepared sounds that are currently registered.
off Removes a function that was hooked using the on function.
on Hooks a function to the specified event.
playSound Plays a registered sound.
run Starts running the game loop.

Remarks

The Engine class is used as the main entry point for a Pixel.js game. An example of how to hook into this can be found in the Getting Started guide.

Supported Platforms

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

In addition to these tested browsers, the Engine class is supported by any browser that supports the HTML5 canvas.