Update server/static/map.js

This commit is contained in:
2025-11-13 17:35:50 +00:00
parent 830758e780
commit 1e2af2011d

View File

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