first step to change tile

This commit is contained in:
GRL 2021-05-27 17:06:39 +02:00
parent 9cd3ff1d31
commit 6dcb0d3750
5 changed files with 334 additions and 21 deletions

View file

@ -44,9 +44,10 @@ interface WorkAdventureApi {
displayBubble(): void;
removeBubble(): void;
loadSound(url : string): Sound;
registerMenuCommand(commandDescriptor: string, callback: (commandDescriptor: string) => void): void
getCurrentUser(): Promise<User>
getCurrentRoom(): Promise<Room>
registerMenuCommand(commandDescriptor: string, callback: (commandDescriptor: string) => void): void;
getCurrentUser(): Promise<User>;
getCurrentRoom(): Promise<Room>;
changeTile(tiles: TileDescriptor[]): void;
//loadTileset(name: string, imgUrl : string, tilewidth : number, tileheight : number, margin : number, spacing : number): void;
onPlayerMove(callback: (playerMovedEvent: HasPlayerMovedEvent) => void): void
@ -65,6 +66,13 @@ interface Room {
startLayer: string | null
}
interface TileDescriptor {
x: number
y: number
tile: number | string
layer: string
}
declare global {
// eslint-disable-next-line no-var
var WA: WorkAdventureApi
@ -221,6 +229,13 @@ window.WA = {
})
},
changeTile(tiles: TileDescriptor[]) {
postToParent({
type: 'changeTile',
data: tiles
})
},
/**
* Send a message in the chat.
* Only the local user will receive this message.