API Documentation for: 0.11.8
Show:

platypus.components.RenderDebug Class

This component is attached to entities that will appear in the game world. It serves two purposes. First, it displays a rectangle that indicates the location of the entity. By default it uses the specified position and dimensions of the object (in grey). If the object has a collision component it will display the AABB of the collision shape (in pink). If the entity has a LogicCarrier component and is/was carrying an object, a green rectangle will be drawn showing the collision group. The RenderDebug component also allows the developer to right-click on an entity and it will print the object in the debug console.

Methods

'handle-render'

()

Defined in 'handle-render':143

Repositions the pieces of the component in preparation for rendering

'load'

()

Defined in 'load':128

Available since 0.11.3

Removes this component if not in a debug build.

'orientation-updated'

()

On receiving this message, will re-orient itself on the next update.

addEventListener

(
  • event
  • callback
)
Function private
This method adds an event listener to the entity.

Parameters:

  • event String
    The event that this component should listen for.
  • callback Function
    The handler for the event.

Returns:

Function: handler A reference to the bound handler.

addMethod

(
  • name
  • func
)
private
This method adds a method to the entity.

Parameters:

  • name String
    The name of the method. For example, if name is "turnYellow", the method is accessible on the entity as entity.turnYellow().
  • func Function
    The function describing the method.

destroy

() private

Inherited from platypus.Component: destroy:54

This method cleans up listeners and methods that this component added to the entity. It should never be called by the component itself. Call this.owner.removeComponent(this) instead.

getAssetList

(
  • definition
  • properties
  • defaultProperties
)
Array
This method can be overwritten to provide the list of assets this component requires. This method is invoked when the list of game scenes is created to determine assets for each scene.

Parameters:

  • definition Object
    The definition for the component.
  • properties Object
    The properties of the Entity.
  • defaultProperties Object
    The default properties of the Entity.

Returns:

Array: A list of the necessary assets to load.

getLateAssetList

(
  • data
)
Array
This method can be overwritten to provide the list of assets this component requires. This method is invoked when the list of game scenes is created to determine assets for each scene.

Parameters:

  • data Object
    Scene data that affects the list of assets.

Returns:

Array: A list of the necessary assets to load.

removeEventListener

(
  • event
  • callback
)
private
This method removes an event listener from the entity.

Parameters:

  • event String
    The event for which to remove a listener.
  • callback Function
    The listener to remove. If not supplied, all event listeners for the provided event are removed.

removeEventListeners

(
  • [listeners]
)
private
This method removes multiple event listeners from the entity.

Parameters:

  • [listeners] Array optional
    The list of listeners to remove. If not supplied, all event listeners are removed.

removeMethod

(
  • name
)
private
This method removes a method from the entity.

Parameters:

  • name String
    The name of the method to be removed.

toJSON

() Object

Inherited from platypus.Component: toJSON:45

Available since 0.11.0

Returns a JSON object describing the component.

Returns:

Object: Returns a JSON definition that can be used to recreate the component.

toString

() String
Returns a string describing the component.

Returns:

String: Returns the component type as a string of the form "[Component ComponentType]".

Properties

aabbColor

Number | String

Defined in aabbColor:46

Available since 0.11.3

The color to use to highlight an entity's AABB. For example, use "#ffffff" or 0xffffff to set as white.

Default: 0xff88ff

collisionColor

Number | String

Defined in collisionColor:56

Available since 0.11.3

The color to use to highlight an entity's collision shape. For example, use "#ffffff" or 0xffffff to set as white.

Default: 0xff00ff

groupColor

Number | String

Defined in groupColor:66

Available since 0.11.3

The color to use to highlight the AABB for a group of entities attached to this entity. For example, use "#ffffff" or 0xffffff to set as white.

Default: 0x00ff00

height

Number

Defined in height:86

Available since 0.11.3

The height of the entity.

Default: 100

offsetZ

Number

Defined in offsetZ:106

Available since 0.11.3

The local offset in z-index for the rendered debug area.

Default: 10000

renderColor

Number | String

Defined in renderColor:76

Available since 0.11.3

The color to use to highlight an entity. This property is only used if there is no CollisionBasic component attached to the entity: this component uses the entity's width and height properties if defined. For example, use "#ffffff" or 0xffffff to set as white.

Default: 0x0000ff

width

Number

Defined in width:96

Available since 0.11.3

The width of the entity.

Default: 100