Wes Mantooth - HTML5 Canvas Game Engine - Version 2.x - by Jeremy Heminger

Classes organised alphabetically

Game

add_object -> {Array}

creates maxobjects instances of an object and canvas, initializes it and returns a list of IDs
this is intended for multiple canavases

Name Type Description
maxobjects Integer the number of new objects of this type to add
$target Function the target object to duplicate
params Object parameters to pass to the function
$container Object target object to attach the canvas DOM node
w Number width of the canvas to create
h Number height of the canvas to create
noloop Boolean if true the operation will add the object to a seperate array that will not be looped over

add_object_single -> {Number}

creates and instance of an object and canvas, initializes it and returns an ID

Name Type Description
maxobjects Integer the number of new objects of this type to add
$target Function the target object to duplicate
params Object parameters to pass to the function
$container Object target object to attach the canvas DOM node
w Number width of the canvas to create
h Number height of the canvas to create

remove_object -> {Void}

removes an instance of an object from the loop and a canvas based on ID

Name Type Description
f String the instance name
i Number an ID

bindkeys -> {Void}

binds a function to a keyboard key

Name Type Description
m Object a map of functions to bind to keys
e String [ keyup, keypress, keyup ] the default is keyup
$t Object target DOM node (default is document)

key -> {Void}

binds a function to a keyboard key

Name Type Description
e Object the event
f String the event name