use tilewidth and tileheight to center spawn position dynamically

This commit is contained in:
psy 2020-11-25 15:58:10 +01:00
parent 9e835620f1
commit f08aec28c0

View File

@ -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;
}
}
}