$e

DEngine - Physics Engine for Javascript
Source:
Version:
  • 1.0
Author:
To Do:
  • Constrains, Convex Colliders, Multiplayer,

Classes

BaseObject2D
BoxCollider
CircleCollider
PolygonCollider
Texture
Vector2
Object2D

Methods

(static) add2DObject(The, layer)

Source:
Adds a Object2D to the engine in a specified layer
Parameters:
Name Type Description
The Object2D Object2D
layer number The layer of the object (-50 to 50)

(static) addDebugObject(name, obj, vars, duration)

Source:
Adds an object to the debug console
Parameters:
Name Type Description
name string Name to be displayed
obj object The object
vars Array.<string> The vars that are going to be debugged
duration number The duration in scren of the Debbug in seconds

(abstract, static) BaseCollider()

Source:
The Virtual Base Collider

(static) getKey(keyCode) → {bool}

Source:
Checks if the key is pressed
Parameters:
Name Type Description
keyCode string The Key Code
Returns:
Status of the key
Type
bool

(static) init(canvas, start, update)

Source:
Starts the engine
Parameters:
Name Type Description
canvas element The html element of the canvas
start function The user function to be called when the engine starts
update function The user function to be called on each frame

(static) setBackground(value)

Source:
Sets the background color (Default: #FFF)
Parameters:
Name Type Description
value number The Color in HEX

(static) setCatchUp(value)

Source:
Enables the Catch Up function. This function checks if the engine is running slower than the expected speed and tryies to catch up with the expected main timeline
Parameters:
Name Type Description
value boolean On/Off

(static) setDebug(value)

Source:
Enables the debug mode
Parameters:
Name Type Description
value boolean On/Off

(static) setGravity(value)

Source:
Sets the gravity for the physics calcs (Default: 9.98)
Parameters:
Name Type Description
value number The gravity aceleration

(static) setMaxFPS(value)

Source:
Sets the maximum fps of the engine
Parameters:
Name Type Description
value number MAX FPS

(static) setSpeed(value) → {type}

Source:
Sets the speed of the engine (Default: 1)
Parameters:
Name Type Description
value type description
Returns:
description
Type
type

(static) stats()

Source:
Prints the actual engine stats

(static) writeDebugConsole(string, type)

Source:
Writes a message to the debug console
Parameters:
Name Type Description
string string Message
type number Type of message