DrawableComponent

new DrawableComponent(sprite, opacity)

Create a new drawable component.
Parameters:
NameTypeDescription
spritestring | SpriteSprite or identifier of sprite to use
opacitynumberTransparency of sprite

Extends

Members

bounds

Get the bounds of the sprite being used.

sprite

Get the sprite being used.

sprite

Set the sprite for drawing.

Methods

destructor()

Handle the deletion of the component.

draw(ctx)

Draw the component.
Parameters:
NameTypeDescription
ctxCanvasRenderingContext2DCanvas context to draw on

drawDebug(ctx)

Draw debugging info for the component.
Parameters:
NameTypeDescription
ctxCanvasRenderingContext2DCanvas context to draw on

init()

Initialize the component.

update(elapsed)

Update the component.
Parameters:
NameTypeDescription
elapsednumberTime since last update cycle in seconds