new DrawableComponent(sprite, opacity)
Create a new drawable component.
Parameters:
Name | Type | Description |
---|---|---|
sprite | string | | Sprite or identifier of sprite to use |
opacity | number | Transparency 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.
- Overrides
draw(ctx)
Draw the component.
Parameters:
Name | Type | Description |
---|---|---|
ctx | CanvasRenderingContext2D | Canvas context to draw on |
- Overrides
drawDebug(ctx)
Draw debugging info for the component.
Parameters:
Name | Type | Description |
---|---|---|
ctx | CanvasRenderingContext2D | Canvas context to draw on |
- Overrides
init()
Initialize the component.
- Overrides
update(elapsed)
Update the component.
Parameters:
Name | Type | Description |
---|---|---|
elapsed | number | Time since last update cycle in seconds |
- Overrides