API Docs for: 0.1.0
Show:

zerk.game.engine.entity.box Class

Simple box entity

Methods

_bodyApplyImpulse

(
  • bodyKey
  • degrees
  • power
)
protected

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
)
protected

Destroys given body

Parameters:

  • bodyKey String

_getBodyLinearVelocity

(
  • bodyKey
)
Object protected

Returns the linear velocity of given body

Parameters:

  • bodyKey String

Returns:

Object:

_getBodyPosition

(
  • bodyKey
)
Object protected

Returns position of given body

Parameters:

  • bodyKey String

Returns:

Object: Position

_setBodyKinematic

(
  • bodyKey
)
protected

Sets given body to be kinematic

Parameters:

  • bodyKey String

_setBodyMoveable

(
  • bodyKey
  • moveable
)
protected

Sets whether given body is moveable

Parameters:

  • bodyKey String
  • moveable Boolean

_setBodyPosition

(
  • bodyKey
  • position
)
protected

Sets the position of given body

Parameters:

  • bodyKey String
  • position Object

_setBodySleepingAllowed

(
  • bodyKey
  • allowed
)
protected

Sets whether given body is allowed to sleep

Parameters:

  • bodyKey String
  • allowed Boolean

_setLinearVelocity

(
  • bodyKey
  • degrees
  • power
)
protected

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
)
Boolen

Fire event

Parameters:

  • event String

    Event name

Returns:

Boolen: Returns false when the bubble was canceled

getBody

(
  • key
)
zerk.game.engine.physics.body

Returns a body by key

Parameters:

  • key String

    Key of the body

Returns:

init

(
  • engine
  • config
)

Class constructor

Parameters:

on

(
  • event
  • callback
  • scope
)

Register event handler

Parameters:

  • event String

    Event name

  • callback Function

    Callback function. Return false to cancel event bubble.

  • scope Object

    Scope to be used in callback function

setup

()

Setup bodies

un

(
  • event
  • callback
)
Boolen

Unregister event handler

Parameters:

  • event String

    Event name

  • callback Function

    Callback function

Returns:

Boolen: Returns true on success

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:

contactend

Fires when two fixtures stop colliding

Event Payload:

contactpostsolve

Fires before two fixtures start colliding

Event Payload:

spawn

Fires when the entity gets spawned

tick

Fires every world simulation tick