chatbn Posted March 12, 2015 Share Posted March 12, 2015 trying to create a new level in my game, i am loading the level by destroying a previous tilemap layer and then adding a new one to the same variables. however, when i reset the player it appears behind the tiles, any way i can just change the order and make sure the player is in front of my tilemap?layer.destroy(); //removes all tiles from stage map = this.add.tilemap('level2'); map.addTilesetImage('level2', 'tiles'); layer = map.createLayer('Tile Layer 1'); map.setCollision([1,2,4,5,6,7,8]); //add second level and move player to beginning of level player.reset(32,150); Link to comment Share on other sites More sharing options...
valueerror Posted March 12, 2015 Share Posted March 12, 2015 create a group for everything.. backgroundlayer1layer2foreground add every item in your game to one of those group.. if you initialize "background" first and "foreground" last - background will be under foreground and everything added to the group background (even later in the game) will be under the other layers.. ZoomBox 1 Link to comment Share on other sites More sharing options...
Recommended Posts