A player in the game.
Signature:
export default class Player extends EventRouter implements protocol.Serializable Extends: EventRouter
Implements: protocol.Serializable
Players are automatically created when they connect and authenticate with the game server. This is all handled internally.
This class is an EventRouter, and instances of it emit events with payloads listed under PlayerEventPayloads
The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the Player class.
|
Property |
Modifiers |
Type |
Description |
|---|---|---|---|
|
|
The camera for the player. | ||
|
|
string |
The unique HYTOPIA UUID for the player. | |
|
|
The current PlayerInput of the player. | ||
|
|
string | undefined |
The profile picture URL for the player. | |
|
|
The UI for the player. | ||
|
|
string |
The unique HYTOPIA username for the player. | |
|
|
World | undefined |
The current World the player is in. |
|
Method |
Modifiers |
Description |
|---|---|---|
|
Disconnects the player from the game server. | ||
|
Get the persisted data for the player. | ||
|
Joins a player to a world. | ||
|
Resets all inputs keys | ||
|
Set the persisted data for the player. This data can later be retrieved using Player.getPersistedData(), even if a player disconnects and rejoin a game in the future, or joins a different HYTOPIA managed lobby of your game. |