kay Posted June 24, 2014 Share Posted June 24, 2014 I'm using the tilemap feature to load levels. But the examples mention, that I have to load all tileset images "manually". So my idea was to load all my stuff and then check the tilemaps in the cache for needed images and load them after the load-complete. This doesn't work. Later in the game, the cache says it doesn't know the keys, where I stored the images at. Is there a better way or do I have to load the json with my own ajax request and get the infos for the loader before I tell it which assets he has to load? Link to comment Share on other sites More sharing options...
j0hnskot Posted June 24, 2014 Share Posted June 24, 2014 Can you explain it a bit more? Or give us some code? Do you load images outside the preload method? Link to comment Share on other sites More sharing options...
kay Posted June 24, 2014 Author Share Posted June 24, 2014 Yes.My function looks like this: load-tilemap:(id, url)!-> @game.load.tilemap id, url, void, Phaser.Tilemap.TILED_JSON @game.load.on-load-complete.add-once !~> map-config = @game.cache.get-tilemap-data id tilesets = map-config.data.tilesets for tileset in tilesets @game.load.image tileset.name, "assets/#{tileset.image}"loading a tilemap getting the JSON tilemap data getting the tileset data loading all the tilesets configured in the tilemap JSONLater I use the same JSON tilemap data again to add all the needed tilesets to the created tilemap. But the cache can't find them with the given keys create-tileset-images:(tilesets)!-> for tileset in tilesets @tilemap.add-tileset-image tileset.name, tileset.name Link to comment Share on other sites More sharing options...
Recommended Posts