Update server/static/map.js
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user