Class: BodySprite

BodySprite(optionsopt)

This draws a body from the physics System.

Constructor

new BodySprite(optionsopt)

Parameters:
Name Type Attributes Default Description
options Object <optional>
{}
Properties
Name Type Attributes Default Description
drawVelocity boolean <optional>
false Determine whether to draw a representation of the velocity.
drawBounds boolean <optional>
false Determine whether to draw the bounding box.
Source:

Extends

Members

angle :number

Angle in degrees
Type:
  • number
Overrides:
Source:

drawBounds :boolean

Determine whether to draw the bounding box.
Type:
  • boolean
Source:

drawPosition :boolean

Determine whether to draw the position of the body.
Type:
  • boolean
Source:

drawVelocity :boolean

Determine whether to draw a representation of the velocity.
Type:
  • boolean
Source:

orientation :Angle

Orientation of the sprite
Type:
Overrides:
Source:

parent :Group|null

Type:
Overrides:
Source:

position :Vector2

World space position.
Type:
Overrides:
Source:

Methods

fromJson(renderer)

Parameters:
Name Type Description
renderer Renderer
Inherited From:
Source:

init(entity)

Parameters:
Name Type Description
entity Entity
Overrides:
Source:

render(ctx, dt)

Parameters:
Name Type Description
ctx CanvasRenderingContext2D
dt number
Overrides:
Source:

toJson() → {*}

Inherited From:
Source:
Returns:
Type
*