DEngine - Physics Engine for Javascript
Classes
Methods
(static) add2DObject(The, layer)
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)
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()
The Virtual Base Collider
(static) getKey(keyCode) → {bool}
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)
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)
Sets the background color (Default: #FFF)
Parameters:
| Name | Type | Description |
|---|---|---|
value |
number | The Color in HEX |
(static) setCatchUp(value)
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)
Enables the debug mode
Parameters:
| Name | Type | Description |
|---|---|---|
value |
boolean | On/Off |
(static) setGravity(value)
Sets the gravity for the physics calcs (Default: 9.98)
Parameters:
| Name | Type | Description |
|---|---|---|
value |
number | The gravity aceleration |
(static) setMaxFPS(value)
Sets the maximum fps of the engine
Parameters:
| Name | Type | Description |
|---|---|---|
value |
number | MAX FPS |
(static) setSpeed(value) → {type}
Sets the speed of the engine (Default: 1)
Parameters:
| Name | Type | Description |
|---|---|---|
value |
type | description |
Returns:
description
- Type
- type
(static) stats()
Prints the actual engine stats
(static) writeDebugConsole(string, type)
Writes a message to the debug console
Parameters:
| Name | Type | Description |
|---|---|---|
string |
string | Message |
type |
number | Type of message |