Add button in bottom right to wait
This commit is contained in:
@@ -144,6 +144,12 @@ export class GameScene extends Phaser.Scene {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.events.on("player-wait", () => {
|
||||||
|
if (!this.awaitingPlayer) return;
|
||||||
|
if (this.isMenuOpen || this.isInventoryOpen || this.dungeonRenderer.isMinimapVisible()) return;
|
||||||
|
this.commitPlayerAction({ type: "wait" });
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Zoom Control
|
// Zoom Control
|
||||||
|
|||||||
@@ -44,5 +44,30 @@ export class PersistentButtonsComponent {
|
|||||||
createBtn(105, "STATS (C)", "toggle-character");
|
createBtn(105, "STATS (C)", "toggle-character");
|
||||||
createBtn(200, "BACKPACK (I)", "toggle-inventory");
|
createBtn(200, "BACKPACK (I)", "toggle-inventory");
|
||||||
createBtn(320, "MAP (M)", "toggle-minimap");
|
createBtn(320, "MAP (M)", "toggle-minimap");
|
||||||
|
|
||||||
|
// Right-aligned buttons
|
||||||
|
const rightContainer = this.scene.add.container(this.scene.scale.width - 20, height - 20);
|
||||||
|
rightContainer.setScrollFactor(0).setDepth(1500);
|
||||||
|
|
||||||
|
const waitBtn = this.scene.add.text(0, 0, "🕒", {
|
||||||
|
fontSize: "24px",
|
||||||
|
color: "#ffffff",
|
||||||
|
backgroundColor: "#1a1a1a",
|
||||||
|
padding: { x: 10, y: 6 },
|
||||||
|
fontStyle: "bold"
|
||||||
|
})
|
||||||
|
.setOrigin(1, 1)
|
||||||
|
.setInteractive({ useHandCursor: true });
|
||||||
|
|
||||||
|
waitBtn.on("pointerover", () => waitBtn.setBackgroundColor("#333333"));
|
||||||
|
waitBtn.on("pointerout", () => waitBtn.setBackgroundColor("#1a1a1a"));
|
||||||
|
waitBtn.on("pointerdown", () => {
|
||||||
|
waitBtn.setBackgroundColor("#444444");
|
||||||
|
const gameScene = this.scene.scene.get("GameScene");
|
||||||
|
gameScene.events.emit("player-wait");
|
||||||
|
});
|
||||||
|
waitBtn.on("pointerup", () => waitBtn.setBackgroundColor("#333333"));
|
||||||
|
|
||||||
|
rightContainer.add(waitBtn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user