Change Tiles
This commit is contained in:
parent
24cc340cb9
commit
a666bf310b
6 changed files with 146 additions and 39 deletions
|
@ -112,3 +112,26 @@ WA.room.getCurrentUser().then((user) => {
|
|||
}
|
||||
})
|
||||
```
|
||||
|
||||
### Changing tiles
|
||||
```
|
||||
WA.room.changeTile(tiles: TileDescriptor[]): void
|
||||
```
|
||||
Replace the tile at the `x` and `y` coordinates in the layer named `layer` by the tile with the id `tile`.
|
||||
`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.
|
||||
|
||||
**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.
|
||||
|
||||
Example :
|
||||
```javascript
|
||||
WA.room.changeTile([
|
||||
{x: 6, y: 4, tile: 'blue', layer: 'changeTile'},
|
||||
{x: 7, y: 4, tile: 109, layer: 'changeTile'},
|
||||
{x: 8, y: 4, tile: 109, layer: 'changeTile'},
|
||||
{x: 9, y: 4, tile: 'blue', layer: 'changeTile'}
|
||||
]);
|
||||
```
|
Loading…
Add table
Add a link
Reference in a new issue