Constructor
new Me()
This class holds the state of the local player, including their ID, team information, position, score, and penalty. It provides a method to update the player's state based on server payload and time. * @property {string|null} id - The unique identifier of the player.
PropertiesName | Type | Description |
---|---|---|
teamId | string | | The ID of the team the player belongs to. |
teamName | string | | The name of the team the player belongs to. |
name | string | | The name of the player. |
x | number | | The x-coordinate of the player's position. |
y | number | | The y-coordinate of the player's position. |
score | number | | The current score of the player. |
penalty | number | | The current penalty of the player. |
ms | number | | The timestamp in milliseconds when the player's state was last updated. |
frame | number | | The frame number when the player's state was last updated. |
- Source
Classes
Methods
update(payload, time)
This method updates the player's ID, name, team information, position, score, and penalty, as well as the timestamp and frame number for the current state.
Parameters:
Name | Type | Description |
---|---|---|
payload | Object | The data received from the server containing player information. |
time | Object | An object containing the current time in milliseconds and frame number. |
- Source