import {CurrentGamerInterface, GamerInterface, Player} from "../Player/Player";
import {DEBUG_MODE, RESOLUTION, ZOOM_LEVEL} from "../../Enum/EnvironmentVariable";
import Tile = Phaser.Tilemaps.Tile;
+ import {ITiledMap, ITiledTileSet} from "../Map/ITiledMap";
+import {cypressAsserter} from "../../Cypress/CypressAsserter";
export enum Textures {
Rock = 'rock',
//hook preload scene
preload(): void {
- this.load.image(Textures.Tiles, 'maps/tiles.png');
- this.load.tilemapTiledJSON(Textures.Map, 'maps/map2.json');
+ cypressAsserter.preloadStarted();
+ let mapUrl = 'maps/map2.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
+ this.map = data.data;
+ this.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',