Methods
# static beginRotationOffset(context, x, y, angle) → {void}
Calculate offset and begin rotating entity to given angle at position.
Parameters:
Name | Type | Description |
---|---|---|
context |
CanvasRenderingContext2D
|
the canvas context for rendering |
x |
number
|
the entity x-coordinate |
y |
number
|
the entity y-coordinate |
angle |
number
|
the angle to rotate on the canvas |
void
# static deadEnemy(context, color) → {void}
Draw dead enemy.
Parameters:
Name | Type | Description |
---|---|---|
context |
CanvasRenderingContext2D
|
the canvas context for rendering |
color |
Object
|
the colors for the components |
void
# static deadPlayer(context) → {void}
Draw dead player.
Parameters:
Name | Type | Description |
---|---|---|
context |
CanvasRenderingContext2D
|
the canvas context for rendering |
void
# static endRotationOffset(context, x, y, angle) → {void}
Stop rotating entity to given angle at position.
Parameters:
Name | Type | Description |
---|---|---|
context |
CanvasRenderingContext2D
|
the canvas context for rendering |
x |
number
|
the entity x-coordinate |
y |
number
|
the entity y-coordinate |
angle |
number
|
the angle to rotate on the canvas |
void
# static enemy(context, position, color) → {void}
Draw enemy.
Parameters:
Name | Type | Description |
---|---|---|
context |
CanvasRenderingContext2D
|
the canvas context for rendering |
position |
number
|
the entity's position for feet animation |
color |
Object
|
the colors for the components |
void
# static health(context, x, y, health) → {void}
Draw entity health bar.
Parameters:
Name | Type | Description |
---|---|---|
context |
CanvasRenderingContext2D
|
the canvas context for rendering |
x |
number
|
the entity x-coordinate |
y |
number
|
the entity y-coordinate |
health |
number
|
the entity's health value |
void
# static player(context, position) → {void}
Draw the player entity.
Parameters:
Name | Type | Description |
---|---|---|
context |
CanvasRenderingContext2D
|
the canvas context for rendering |
position |
number
|
the entity's position for feet animation |
void
# static render(context, entity) → {void}
Render the entity on the canvas.
This method is called on every frame/repaint. It checks to see if the entity render state
is active, and checks the entity type to apply specified behaviour and styles.
Parameters:
Name | Type | Description |
---|---|---|
context |
CanvasRenderingContext2D
|
the canvas context for rendering. |
entity |
Object
|
the entity to render |
void