diff --git a/docs/maps/api-player.md b/docs/maps/api-player.md index a8280a6c..4dfb52c7 100644 --- a/docs/maps/api-player.md +++ b/docs/maps/api-player.md @@ -174,6 +174,9 @@ WA.player.state.toto //will retrieve the variable ``` ### Move player to position +```typescript +WA.player.moveTo(x: number, y: number, speed?: number): Promise<{ x: number, y: number }>; +``` Player will try to find shortest path to the destination point and proceed to move there. ```typescript // Let's move player to x: 250 y: 250 with speed of 10 @@ -185,6 +188,11 @@ You can also chain movement like this: await WA.player.moveTo(250, 250, 10); await WA.player.moveTo(500, 0, 10); ``` +It is possible to get the information about current player's position on stop or when movement is interrupted +```typescript +// Position will store x and y of Player at the moment of movement's end +const position = await WA.player.moveTo(250, 250, 10); +``` ### Set the outline color of the player ```