Fix JS issue regarding multiple tilesets

This commit is contained in:
NIP 2020-04-13 21:24:48 +02:00
parent 84f0420694
commit c42dbc3f95

View 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);