javascript - Change map to another using tileset -


i'm creating game using phaser.js.

it's 2d-retro-rpg-you've-seen-it-100000000-times , i'm using tiled create maps.

how supposed change map tileset? i'm quite confused this. couldn't find definite answer in net.

suppose player reaches end of level 1, want load level 2.

you can use variable called "currentlevel". , call create method when want change levels:

gamestate.prototype.create = function() {      // (...)      // level creation     this.level = new level(this.game, this.currentlevel);      // (...) 

};

and in level.js can have this:

var level = function(game, levelnumber) {     // load tilemap     phaser.tilemap.call(this, game, levelnumber);      // (...) more logic load data json }; 

have been clear enough? hope helps!


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -