Fix JS issue regarding multiple tilesets
authorNIP <n.peguin@thecodingmachine.com>
Mon, 13 Apr 2020 19:24:48 +0000 (21:24 +0200)
committerNIP <n.peguin@thecodingmachine.com>
Mon, 13 Apr 2020 19:24:48 +0000 (21:24 +0200)
front/src/Phaser/Game/GameScene.ts

index ab4703e136e0aecf1d80b74cb04bd8e423972de7..f202c7c81e38f23cafaee77c3a89d340e0f4ded6 100644 (file)
@@ -9,7 +9,8 @@ export enum Textures {
     Rock = 'rock',
     Player = 'playerModel',
     Map = 'map',
-    Tiles = 'tiles'
+    Tiles = 'tiles',
+    Tiles2 = 'tiles2'
 }
 
 export interface GameSceneInterface extends Phaser.Scene {
@@ -42,7 +43,7 @@ export class GameScene extends Phaser.Scene implements GameSceneInterface{
     //hook preload scene
     preload(): void {
         this.load.image(Textures.Tiles, 'maps/floortileset.png');
-        this.load.image(Textures.Tiles, 'maps/tilesets_deviant_milkian_1.png');
+        this.load.image(Textures.Tiles2, 'maps/tilesets_deviant_milkian_1.png');
         this.load.tilemapTiledJSON(Textures.Map, 'maps/map.json');
         this.load.image(Textures.Rock, 'resources/objects/rockSprite.png');
         this.load.spritesheet(Textures.Player,
@@ -61,6 +62,8 @@ export class GameScene extends Phaser.Scene implements GameSceneInterface{
         this.Map = this.add.tilemap("map");
         this.Terrain = this.Map.addTilesetImage("tiles", "tiles");
         this.Map.createStaticLayer("tiles", "tiles");
+        this.Terrain = this.Map.addTilesetImage("tiles2", "tiles2");
+        this.Map.createStaticLayer("tiles2", "tiles2");
 
         //permit to set bound collision
         this.physics.world.setBounds(0,0, this.Map.widthInPixels, this.Map.heightInPixels);