Jump to content

order of objects on the canvas


chatbn
 Share

Recommended Posts

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

create a group for everything..  

 

background

layer1

layer2

foreground

 

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..

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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