@@ -148,10 +151,10 @@ If `tile` is a string, it's not the id of the tile but the value of the property
`TileDescriptor` has the following attributes :
-* **x (number) :** The coordinate x of the tile that you want to replace.
-* **y (number) :** The coordinate y of the tile that you want to replace.
-* **tile (number | string) :** The id of the tile that will be placed in the map.
-* **layer (string) :** The name of the layer where the tile will be placed.
+- **x (number) :** The coordinate x of the tile that you want to replace.
+- **y (number) :** The coordinate y of the tile that you want to replace.
+- **tile (number | string) :** The id of the tile that will be placed in the map.
+- **layer (string) :** The name of the layer where the tile will be placed.
**Important !** : If you use `tile` as a number, be sure to add the `firstgid` of the tileset of the tile that you want
to the id of the tile in Tiled Editor.
@@ -160,12 +163,12 @@ Note: If you want to unset a tile, use `setTiles` with `tile` set to `null`.
Example :
-```javascript
+```ts
WA.room.setTiles([
- { x: 6, y: 4, tile: 'blue', layer: 'setTiles' },
- { x: 7, y: 4, tile: 109, layer: 'setTiles' },
- { x: 8, y: 4, tile: 109, layer: 'setTiles' },
- { x: 9, y: 4, tile: 'blue', layer: 'setTiles' }
+ { x: 6, y: 4, tile: "blue", layer: "setTiles" },
+ { x: 7, y: 4, tile: 109, layer: "setTiles" },
+ { x: 8, y: 4, tile: 109, layer: "setTiles" },
+ { x: 9, y: 4, tile: "blue", layer: "setTiles" },
]);
```
@@ -179,10 +182,10 @@ Load a tileset in JSON format from an url and return the id of the first tile of
You can create a tileset file in Tile Editor.
-```javascript
+```ts
WA.room.loadTileset("Assets/Tileset.json").then((firstId) => {
- WA.room.setTiles([{ x: 4, y: 4, tile: firstId, layer: 'bottom' }]);
-})
+ WA.room.setTiles([{ x: 4, y: 4, tile: firstId, layer: "bottom" }]);
+});
```
## Embedding websites in a map
@@ -199,10 +202,10 @@ WA.room.website.get(objectName: string): Promise
You can get an instance of an embedded website by using the `WA.room.website.get()` method. It returns a promise of
an `EmbeddedWebsite` instance.
-```javascript
+```ts
// Get an existing website object where 'my_website' is the name of the object (on any layer object of the map)
-const website = await WA.room.website.get('my_website');
-website.url = 'https://example.com';
+const website = await WA.room.website.get("my_website");
+website.url = "https://example.com";
website.visible = true;
```
@@ -231,7 +234,7 @@ interface CreateEmbeddedWebsiteEvent {
You can create an instance of an embedded website by using the `WA.room.website.create()` method. It returns
an `EmbeddedWebsite` instance.
-```javascript
+```ts
// Create a new website object
const website = WA.room.website.create({
name: "my_website",
@@ -269,10 +272,10 @@ class EmbeddedWebsite {
visible: boolean;
allow: string;
allowApi: boolean;
- x: number; // In "game" pixels, relative to the map or player coordinates, depending on origin
- y: number; // In "game" pixels, relative to the map or player coordinates, depending on origin
- width: number; // In "game" pixels
- height: number; // In "game" pixels
+ x: number; // In "game" pixels, relative to the map or player coordinates, depending on origin
+ y: number; // In "game" pixels, relative to the map or player coordinates, depending on origin
+ width: number; // In "game" pixels
+ height: number; // In "game" pixels
origin: "player" | "map";
scale: number;
}
@@ -282,4 +285,3 @@ When you modify a property of an `EmbeddedWebsite` instance, the iframe is autom
{.alert.alert-warning} The websites you add/edit/delete via the scripting API are only shown locally. If you want them
to be displayed for every player, you can use [variables](api-start.md) to share a common state between all users.
-
diff --git a/front/src/Phaser/Game/GameScene.ts b/front/src/Phaser/Game/GameScene.ts
index 8c5df9b7..3e53bb3f 100644
--- a/front/src/Phaser/Game/GameScene.ts
+++ b/front/src/Phaser/Game/GameScene.ts
@@ -1463,7 +1463,6 @@ ${escapedMessage}
});
iframeListener.registerAnswerer("movePlayerTo", async (message) => {
- // TODO: walk player to position, wait for promise to resolve
const index = this.getGameMap().getTileIndexAt(message.x, message.y);
const startTile = this.getGameMap().getTileIndexAt(this.CurrentPlayer.x, this.CurrentPlayer.y);
const path = await this.getPathfindingManager().findPath(startTile, index, true, true);