//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',