Merge pull request #440 from psy/develop

center spawn position in the middle of a tile
This commit is contained in:
David Négrier 2020-12-11 17:36:10 +01:00 committed by GitHub
commit 855b55903b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -708,8 +708,8 @@ export class GameScene extends ResizableScene implements CenterListener {
for (const layer of this.mapFile.layers) { for (const layer of this.mapFile.layers) {
if (layerName === layer.name && layer.type === 'tilelayer' && (layerName === defaultStartLayerName || this.isStartLayer(layer))) { if (layerName === layer.name && layer.type === 'tilelayer' && (layerName === defaultStartLayerName || this.isStartLayer(layer))) {
const startPosition = this.startUser(layer); const startPosition = this.startUser(layer);
this.startX = startPosition.x; this.startX = startPosition.x + this.mapFile.tilewidth/2;
this.startY = startPosition.y; this.startY = startPosition.y + this.mapFile.tileheight/2;
} }
} }
} }