diff --git a/server/static/map.js b/server/static/map.js index 5e5194e..bb09ccc 100644 --- a/server/static/map.js +++ b/server/static/map.js @@ -20,6 +20,11 @@ export class MapView { this.otherSprites = new Map(); // socket.id -> { img,label } } + getPlayerPosition() { + if (!this.player) return { x: 0, y: 0 }; + return { x: this.player.x, Y: this.player.y}; + } + create(me, world, nodes) { const W = world?.width || this.config.width; const H = world?.height || this.config.height; @@ -52,6 +57,7 @@ export class MapView { } g.setDepth(-100); // stay behind everything + // Player sprite const startPos = this.snapToTile(me.x, me.y); this.player = this.scene.add.image(startPos.x, startPos.y, 'player').setDepth(10);