scroll factor applied automatically

This commit is contained in:
Hanusiak Piotr 2022-02-08 13:17:35 +01:00
parent a53cbbff34
commit 57bd8783e0
3 changed files with 79 additions and 7 deletions

View File

@ -85,6 +85,7 @@ export class GameMap {
phaserMap phaserMap
.createLayer(layer.name, terrains, (layer.x || 0) * 32, (layer.y || 0) * 32) .createLayer(layer.name, terrains, (layer.x || 0) * 32, (layer.y || 0) * 32)
.setDepth(depth) .setDepth(depth)
.setScrollFactor(layer.parallaxx ?? 1, layer.parallaxy ?? 1)
.setAlpha(layer.opacity) .setAlpha(layer.opacity)
.setVisible(layer.visible) .setVisible(layer.visible)
.setSize(layer.width, layer.height) .setSize(layer.width, layer.height)
@ -94,7 +95,6 @@ export class GameMap {
depth = DEPTH_OVERLAY_INDEX; depth = DEPTH_OVERLAY_INDEX;
} }
} }
console.log(this.phaserLayers);
for (const tileset of map.tilesets) { for (const tileset of map.tilesets) {
tileset?.tiles?.forEach((tile) => { tileset?.tiles?.forEach((tile) => {
if (tile.properties) { if (tile.properties) {

View File

@ -78,6 +78,8 @@ export interface ITiledMapTileLayer {
width: number; width: number;
x: number; x: number;
y: number; y: number;
parallaxx: number;
parallaxy: number;
/** /**
* Draw order (topdown (default), index) * Draw order (topdown (default), index)

File diff suppressed because one or more lines are too long