UNPKG

hytopia

Version:

The HYTOPIA SDK makes it easy for developers to create massively multiplayer games using JavaScript or TypeScript.

64 lines (31 loc) 1.08 kB
<!-- Do not edit this file. It is automatically generated by API Documenter. --> [Home](./index.md) &gt; [server](./server.md) &gt; [Player](./server.player.md) &gt; [joinWorld](./server.player.joinworld.md) ## Player.joinWorld() method Assigns the player to a world. Use for: initial placement or moving a player between worlds. Do NOT use for: respawning or teleporting within the same world. **Signature:** ```typescript joinWorld(world: World): void; ``` ## Parameters <table><thead><tr><th> Parameter </th><th> Type </th><th> Description </th></tr></thead> <tbody><tr><td> world </td><td> [World](./server.world.md) </td><td> The world to join the player to. \*\*Side effects:\*\* Emits `PlayerEvent.JOINED_WORLD` and `PlayerEvent.LEFT_WORLD` during world switches. \*\*Category:\*\* Players </td></tr> </tbody></table> **Returns:** void ## Remarks If switching worlds, the player is internally disconnected/reconnected and `JOINED_WORLD` is emitted after reconnection completes.