Jump to content
This forum will be closing down. Please move to the respective dedicated project forums.

Remove a tilemap and replace it with a new one.


Heppell08
 Share

Recommended Posts

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 :)

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...