Merge pull request #222 from thecodingmachine/fix_tileset_key

Fixing image tileset key
This commit is contained in:
David Négrier 2020-07-07 18:31:41 +02:00 committed by GitHub
commit 24c2de94ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -229,7 +229,7 @@ export class GameScene extends Phaser.Scene {
return; return;
} }
//TODO strategy to add access token //TODO strategy to add access token
this.load.image(tileset.name, `${url}/${tileset.image}`); this.load.image(`${url}/${tileset.image}`, `${url}/${tileset.image}`);
}) })
} }
@ -246,8 +246,9 @@ export class GameScene extends Phaser.Scene {
create(): void { create(): void {
//initalise map //initalise map
this.Map = this.add.tilemap(this.MapKey); this.Map = this.add.tilemap(this.MapKey);
const mapDirUrl = this.MapUrlFile.substr(0, this.MapUrlFile.lastIndexOf('/'));
this.mapFile.tilesets.forEach((tileset: ITiledTileSet) => { this.mapFile.tilesets.forEach((tileset: ITiledTileSet) => {
this.Terrains.push(this.Map.addTilesetImage(tileset.name, tileset.name, tileset.tilewidth, tileset.tileheight, tileset.margin, tileset.spacing/*, tileset.firstgid*/)); this.Terrains.push(this.Map.addTilesetImage(tileset.name, `${mapDirUrl}/${tileset.image}`, tileset.tilewidth, tileset.tileheight, tileset.margin, tileset.spacing/*, tileset.firstgid*/));
}); });
//permit to set bound collision //permit to set bound collision