zerk.game.engine.entity.box Class
Simple box entity
Item Index
Methods
Properties
Methods
_bodyApplyImpulse
-
bodyKey
-
degrees
-
power
Applies an impulse to given body
Parameters:
-
bodyKey
String -
degrees
Integer -
power
Integer
_createMapBody
()
protected
Create a map to the physics handles of all bodies by their keys
_destroyBody
-
bodyKey
Destroys given body
Parameters:
-
bodyKey
String
_getBodyLinearVelocity
-
bodyKey
Returns the linear velocity of given body
Parameters:
-
bodyKey
String
Returns:
_getBodyPosition
-
bodyKey
Returns position of given body
Parameters:
-
bodyKey
String
Returns:
_setBodyKinematic
-
bodyKey
Sets given body to be kinematic
Parameters:
-
bodyKey
String
_setBodyMoveable
-
bodyKey
-
moveable
Sets whether given body is moveable
Parameters:
-
bodyKey
String -
moveable
Boolean
_setBodyPosition
-
bodyKey
-
position
Sets the position of given body
Parameters:
-
bodyKey
String -
position
Object
_setBodySleepingAllowed
-
bodyKey
-
allowed
Sets whether given body is allowed to sleep
Parameters:
-
bodyKey
String -
allowed
Boolean
_setLinearVelocity
-
bodyKey
-
degrees
-
power
Sets the linear velocity of given body
Parameters:
-
bodyKey
String -
degrees
Integer -
power
Integer
applyConfig
-
config
Apply configuration object
Parameters:
-
config
Object
destroy
()
Destroys this entity and removes it from the world
fireEvent
-
event
Fire event
Parameters:
-
event
StringEvent name
Returns:
getBody
-
key
Returns a body by key
Parameters:
-
key
StringKey of the body
Returns:
on
-
event
-
callback
-
scope
Register event handler
Parameters:
-
event
StringEvent name
-
callback
FunctionCallback function. Return false to cancel event bubble.
-
scope
ObjectScope to be used in callback function
setup
()
Setup bodies
un
-
event
-
callback
Unregister event handler
Parameters:
-
event
StringEvent name
-
callback
FunctionCallback function
Returns:
Properties
_eventListeners
Array
protected
List of event handlers
height
Integer
Height of the entity
name
String
Name of the entity
width
Integer
Width of the entity
Events
contactbegin
Fires when two fixtures start colliding
Event Payload:
-
sourceFixture
zerk.game.engine.physics.fixtureSource fixture
-
targetFixture
zerk.game.engine.physics.fixtureTarget fixture
contactend
Fires when two fixtures stop colliding
Event Payload:
-
sourceFixture
zerk.game.engine.physics.fixtureSource fixture
-
targetFixture
zerk.game.engine.physics.fixtureTarget fixture
contactpostsolve
Fires before two fixtures start colliding
Event Payload:
-
sourceFixture
zerk.game.engine.physics.fixtureSource fixture
-
targetFixture
zerk.game.engine.physics.fixtureTarget fixture
-
impulse
Object
spawn
Fires when the entity gets spawned
tick
Fires every world simulation tick