From: David NĂ©grier Date: Wed, 15 Apr 2020 17:30:49 +0000 (+0200) Subject: Merging X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=1dd66b4998f2366f69fe70d16b142e643ed9a839;p=libreadventure.git Merging --- 1dd66b4998f2366f69fe70d16b142e643ed9a839 diff --cc front/src/Phaser/Game/GameScene.ts index f202c7c,a089842..d3c1a6d --- a/front/src/Phaser/Game/GameScene.ts +++ b/front/src/Phaser/Game/GameScene.ts @@@ -42,9 -40,17 +41,17 @@@ export class GameScene extends Phaser.S //hook preload scene preload(): void { - this.load.image(Textures.Tiles, 'maps/floortileset.png'); - this.load.image(Textures.Tiles2, 'maps/tilesets_deviant_milkian_1.png'); - this.load.tilemapTiledJSON(Textures.Map, 'maps/map.json'); - let mapUrl = 'maps/map2.json'; ++ let mapUrl = 'maps/map.json'; + this.load.on('filecomplete-tilemapJSON-'+Textures.Map, (key: string, type: string, data: any) => { + // Triggered when the map is loaded + // Load tiles attached to the map recursively + let map: ITiledMap = data.data; + map.tilesets.forEach((tileset) => { + let path = mapUrl.substr(0, mapUrl.lastIndexOf('/')); + this.load.image(tileset.name, path + '/' + tileset.image); + }) + }); + this.load.tilemapTiledJSON(Textures.Map, mapUrl); this.load.image(Textures.Rock, 'resources/objects/rockSprite.png'); this.load.spritesheet(Textures.Player, 'resources/characters/pipoya/Male 01-1.png',