new Player(x, y, initiative)
Class with behavior and attributes for players
Parameters:
| Name | Type | Description |
|---|---|---|
x |
number | initial x-coordinate |
y |
number | initial y-coordinate |
initiative |
number |
- Source:
Methods
cleanUpMovement()
Resets animation position and turn counter
- Source:
createStatsForm()
Menu that displays player stats and lets the player use skill points
to increase the three main stats, Initiative, Attack Speed, and Scout.
- Source:
die()
Removes the player from the map, gives a gameover screen if no players are left alive
- Source:
gainXP(amount)
Gives the player amount of xp, and then levels them up if they have passed a certain threshold
Parameters:
| Name | Type | Description |
|---|---|---|
amount |
int | How much XP the player gets |
- Source:
getName() → {string}
Gets the name of the player
- Source:
Returns:
The name of the player
- Type
- string
getScore() → {number}
Calculates and returns the player's current score.
- Source:
Returns:
The player's current score
- Type
- number
receiveDamage(attackingObject)
Reduces Player's HP by the amount of damage received. If player's hp is reduced to 0, they die.
If no players are left alive, then the game is over.
Parameters:
| Name | Type | Description |
|---|---|---|
attackingObject |
Object |
- Source:
setName(name)
Sets the name of the player
Parameters:
| Name | Type | Description |
|---|---|---|
name |
string | The name to be set |
- Source:
tickActions()
Run on each frame rendering in main loop
- Source:
turn()
Code that gets called when it's the players turn. Initializes the player's action menu
- Source:
updatePlayerUI()
[updatePlayerUI Updates the UI that displays the current player's name and health.]
- Source:
(inner) attackClickHandler() → {MouseEvent}
Click handler for attack
- Source:
Returns:
event
- Type
- MouseEvent
(inner) mouseMoveHandler(event)
Clickhandler for mousemove
Parameters:
| Name | Type | Description |
|---|---|---|
event |
MouseEvent |
- Source:
(inner) moveClickHandler(event)
Click handler for move
Parameters:
| Name | Type | Description |
|---|---|---|
event |
MouseEvent |
- Source: