new UserInterface(ctx, canvasSize, version, images)
- Source:
Parameters:
Name | Type | Description |
---|---|---|
ctx |
CanvasRenderingContext2D | |
canvasSize |
canvasSize | |
version |
number | |
images |
Array.<HTMLImageElement> |
Methods
_drawBulletCount(value)
- Source:
Draw player's bullet count.
Parameters:
Name | Type | Description |
---|---|---|
value |
number | Bullet count. |
_drawControls(x, y)
- Source:
Draw controls in UI
Parameters:
Name | Type | Description |
---|---|---|
x |
number | |
y |
number |
_drawHealth(value)
- Source:
Draw player health.
Parameters:
Name | Type | Description |
---|---|---|
value |
number | Player's current health. |
_drawLogo()
- Source:
Draw Logo on start screen.
_drawScore(value, size)
- Source:
Draw current score.
Parameters:
Name | Type | Description |
---|---|---|
value |
number | Score. |
size |
number | Font size. |
draw(currHealth, bulletCount, score)
- Source:
Draw UI based on the state.
Parameters:
Name | Type | Default | Description |
---|---|---|---|
currHealth |
number |
0
|
Player's current health/lives. |
bulletCount |
number |
0
|
Player's current bullet count. |
score |
number |
0
|
Current score. |
init()
- Source:
Initialize UI.