chatbn Posted March 18, 2015 Share Posted March 18, 2015 i have been trying to add a tile map to a group so that when i destroy a level and add a new one. the player doesnt go behind the layer. it adds the tile map to the screen but the collision doesnt happen.levels = this.add.group(); //add tilemap to the game using preloaded json file map = this.add.tilemap('level'); //add an image to the map to be used as a tileset map.addTilesetImage('tileTest', 'tiles'); //create a new TilemapLayer object and add it to the map, maps can have multiple layers map.setCollision([1,2,4,5,6,7,8]); layer = levels.create(map.createLayer('Tile Layer 1')); Link to comment Share on other sites More sharing options...
chatbn Posted March 18, 2015 Author Share Posted March 18, 2015 solved it! just needed to do add instead of create. layer = map.createLayer('Tile Layer 1'); levels.add(layer); Link to comment Share on other sites More sharing options...
Recommended Posts