Merge pull request #44 from thecodingmachine/map-v0

My first map representing TCM office grand floor without KEN office
This commit is contained in:
David Négrier 2020-04-24 19:08:08 +02:00 committed by GitHub
commit 33bcbd4650
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 305 additions and 19 deletions

View file

@ -44,12 +44,16 @@ export class GameScene extends Phaser.Scene implements GameSceneInterface{
//hook preload scene
preload(): void {
cypressAsserter.preloadStarted();
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
this.map = data.data;
this.map.tilesets.forEach((tileset) => {
if (typeof tileset.name === 'undefined' || typeof tileset.image === 'undefined') {
console.warn("Don't know how to handle tileset ", tileset)
return;
}
let path = mapUrl.substr(0, mapUrl.lastIndexOf('/'));
this.load.image(tileset.name, path + '/' + tileset.image);
})