Add missing layer properties

Enables map makers to set the alpha, visibility, origin and size of layers.

Co-authored-by: jonny <ga86lad@mytum.de>
This commit is contained in:
Chasethechicken 2021-12-21 11:28:07 +01:00
parent e220bf56db
commit 6f4fe47808

View File

@ -81,7 +81,13 @@ 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;