Merging
authorDavid Négrier <d.negrier@thecodingmachine.com>
Wed, 15 Apr 2020 17:30:49 +0000 (19:30 +0200)
committerDavid Négrier <d.negrier@thecodingmachine.com>
Wed, 15 Apr 2020 17:30:49 +0000 (19:30 +0200)
1  2 
front/src/Phaser/Game/GameScene.ts

index f202c7c81e38f23cafaee77c3a89d340e0f4ded6,a089842b79681e5d8e5b94ac92bb99c0da78af6d..d3c1a6d3018d383c22013862101766ed22640f9f
@@@ -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',