From f08aec28c0fcbe69884bf89a805c5a3bc3e8df1b Mon Sep 17 00:00:00 2001 From: psy Date: Wed, 25 Nov 2020 15:58:10 +0100 Subject: [PATCH] use tilewidth and tileheight to center spawn position dynamically --- front/src/Phaser/Game/GameScene.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/front/src/Phaser/Game/GameScene.ts b/front/src/Phaser/Game/GameScene.ts index 681d2892..c43d228e 100644 --- a/front/src/Phaser/Game/GameScene.ts +++ b/front/src/Phaser/Game/GameScene.ts @@ -650,8 +650,8 @@ export class GameScene extends ResizableScene implements CenterListener { for (const layer of this.mapFile.layers) { if (layerName === layer.name && layer.type === 'tilelayer' && (layerName === "start" || this.isStartLayer(layer))) { const startPosition = this.startUser(layer); - this.startX = startPosition.x + 16; - this.startY = startPosition.y + 16; + this.startX = startPosition.x + this.mapFile.tilewidth/2; + this.startY = startPosition.y + this.mapFile.tileheight/2; } } }