Heppell08 Posted February 21, 2014 Share Posted February 21, 2014 Is it possible to have one game.js file with my preloader all ready having loaded the first tilemap for the first level, have a second, third and fourth etc etc loaded in the preloader but then created on tap within a function ingame as well as removing the old map.I figure this would save some time if i were able to use tile functions as a way to carry on within the game and load a new map when and if needed.I was thinking about a single function, within the function declaring the new map with a var and calling it when the next map is loaded. kind of like this:// maps loaded in preloader as level01, level02, level03 etc etcvar map;// the original below asmap = this.add.tilemap('level01'); // the JSON is level01!// then in a function remove the mapvar tileFunc = {mapChange: function(){ // how do i remove the map here // then create the new map here! map = this.add.tilemap('level02'); // add new map in function}}Any help appreciated! Thanks Tilde 1 Link to comment Share on other sites More sharing options...
Heppell08 Posted February 21, 2014 Author Share Posted February 21, 2014 Sorry i figured it out. initiative +1 lol.Code:var tileFunc5 = { mapChange: function() { layer.destroy(); // new creation below!! }} Tilde 1 Link to comment Share on other sites More sharing options...
Recommended Posts