diff --git a/front/src/Phaser/Game/GameMap.ts b/front/src/Phaser/Game/GameMap.ts
index 6688acb8..5778c065 100644
--- a/front/src/Phaser/Game/GameMap.ts
+++ b/front/src/Phaser/Game/GameMap.ts
@@ -81,7 +81,14 @@ export class GameMap {
let depth = -2;
for (const layer of this.flatLayers) {
if (layer.type === "tilelayer") {
- this.phaserLayers.push(phaserMap.createLayer(layer.name, terrains, 0, 0).setDepth(depth));
+ this.phaserLayers.push(
+ phaserMap
+ .createLayer(layer.name, terrains, (layer.x || 0) * 32, (layer.y || 0) * 32)
+ .setDepth(depth)
+ .setAlpha(layer.opacity)
+ .setVisible(layer.visible)
+ .setSize(layer.width, layer.height)
+ );
}
if (layer.type === "objectgroup" && layer.name === "floorLayer") {
depth = DEPTH_OVERLAY_INDEX;
diff --git a/maps/tests/index.html b/maps/tests/index.html
index 066bcaeb..573c02f7 100644
--- a/maps/tests/index.html
+++ b/maps/tests/index.html
@@ -120,6 +120,14 @@
Focusable Zones
+
+
+ Success Failure Pending
+ |
+
+ Layer visibility + Layer size and offset
+ |
+
Iframe API
diff --git a/maps/tests/layer-visibility.json b/maps/tests/layer-visibility.json
new file mode 100644
index 00000000..b06be89b
--- /dev/null
+++ b/maps/tests/layer-visibility.json
@@ -0,0 +1,148 @@
+{ "compressionlevel":-1,
+ "height":9,
+ "infinite":false,
+ "layers":[
+ {
+ "data":[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
+ "height":9,
+ "id":1,
+ "name":"floor",
+ "opacity":1,
+ "type":"tilelayer",
+ "visible":true,
+ "width":9,
+ "x":0,
+ "y":0
+ },
+ {
+ "data":[34, 34, 34, 0, 0, 0, 0, 0, 0, 34, 34, 34, 0, 0, 0, 0, 0, 0, 34, 34, 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ "height":9,
+ "id":7,
+ "name":"invisible",
+ "opacity":1,
+ "type":"tilelayer",
+ "visible":false,
+ "width":9,
+ "x":0,
+ "y":0
+ },
+ {
+ "data":[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ "height":9,
+ "id":2,
+ "name":"start",
+ "opacity":1,
+ "type":"tilelayer",
+ "visible":true,
+ "width":9,
+ "x":0,
+ "y":0
+ },
+ {
+ "data":[78, 79, 80, 89, 90, 91, 100, 101, 102],
+ "height":3,
+ "id":9,
+ "name":"smaller-offset",
+ "opacity":1,
+ "type":"tilelayer",
+ "visible":true,
+ "width":3,
+ "x":3,
+ "y":3
+ },
+ {
+ "draworder":"topdown",
+ "id":3,
+ "name":"floorLayer",
+ "objects":[
+ {
+ "height":113.62434712736,
+ "id":2,
+ "name":"",
+ "rotation":0,
+ "text":
+ {
+ "text":"The striped tiles in the top left corner should be invisible.",
+ "wrap":true
+ },
+ "type":"",
+ "visible":true,
+ "width":108.583142912147,
+ "x":4.76293503917236,
+ "y":3.18514798446498
+ },
+ {
+ "height":196.249229945092,
+ "id":3,
+ "name":"",
+ "rotation":0,
+ "text":
+ {
+ "text":"The striped tiles in the top right corner should be transparent and appear above the player.",
+ "wrap":true
+ },
+ "type":"",
+ "visible":true,
+ "width":148.867058808759,
+ "x":137.442726119928,
+ "y":2.49946430962904
+ },
+ {
+ "height":72.9975893933307,
+ "id":4,
+ "name":"",
+ "rotation":0,
+ "text":
+ {
+ "text":"The plant should be here (the center of the map)",
+ "wrap":true
+ },
+ "type":"",
+ "visible":true,
+ "width":151.609793508102,
+ "x":78.3025091653274,
+ "y":173.920383018616
+ }],
+ "opacity":1,
+ "type":"objectgroup",
+ "visible":true,
+ "x":0,
+ "y":0
+ },
+ {
+ "data":[0, 0, 0, 0, 0, 0, 34, 34, 34, 0, 0, 0, 0, 0, 0, 34, 34, 34, 0, 0, 0, 0, 0, 0, 34, 34, 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ "height":9,
+ "id":8,
+ "name":"transparent",
+ "opacity":0.4,
+ "type":"tilelayer",
+ "visible":true,
+ "width":9,
+ "x":0,
+ "y":0
+ }],
+ "nextlayerid":10,
+ "nextobjectid":5,
+ "orientation":"orthogonal",
+ "renderorder":"right-down",
+ "tiledversion":"1.7.2",
+ "tileheight":32,
+ "tilesets":[
+ {
+ "columns":11,
+ "firstgid":1,
+ "image":"tileset1.png",
+ "imageheight":352,
+ "imagewidth":352,
+ "margin":0,
+ "name":"tileset1",
+ "spacing":0,
+ "tilecount":121,
+ "tileheight":32,
+ "tilewidth":32
+ }],
+ "tilewidth":32,
+ "type":"map",
+ "version":"1.6",
+ "width":9
+}
\ No newline at end of file