DanielP565 Posted April 19, 2016 Share Posted April 19, 2016 I'm trying to offset tilemaps for each room I have and the collision doesn't seem to go with it. Link to game: here You can see the collision overlaps eachother on the first tilemap and there is no collision on the second one. createMap: function() { this.layers = {}; this.map = this.game.add.tilemap('east'); this.map.addTilesetImage('dungeon_tiles', 'tiles'); var rnd = 1; console.log("rolled a ", rnd); this.map.layers.forEach(function (layer) { this.layers[layer.name] = this.map.createLayer(layer.name); this.layers[layer.name].fixedToCamera = false; if(layer.properties.collision) { this.map.setCollision(291, true, layer.name); collision = this.map.getLayer(layer).name; } if(layer.properties.ignore) { return; } else if(layer.properties.group == rnd) { this.layers[layer.name].visible = true; } else { this.layers[layer.name].visible = false; } }, this); this.layers2 = {}; this.map2 = this.game.add.tilemap('map'); this.map2.addTilesetImage('dungeon_tiles', 'tiles'); this.map2.layers.forEach(function (layer) { this.layers2[layer.name] = this.map2.createLayer(layer.name); this.layers2[layer.name].fixedToCamera = false; this.layers2[layer.name].position.set(256, 0); if(layer.properties.collision) { this.map2.setCollision(291, true, layer.name); collision2 = this.map2.getLayer(layer).name; } }, this); this.layers[collision].debug = true; this.layers2[collision2].debug = true; }, Link to comment Share on other sites More sharing options...
DanielP565 Posted April 22, 2016 Author Share Posted April 22, 2016 Anyone know how to move them correctly to fix this? Link to comment Share on other sites More sharing options...
Recommended Posts