Add character (warrior) and rat/bat sprites

This commit is contained in:
Peter Stockings
2026-01-04 15:34:56 +11:00
parent ace13377a2
commit 3785885abe
8 changed files with 154 additions and 9 deletions

View File

@@ -38,6 +38,12 @@ export class GameScene extends Phaser.Scene {
super("GameScene");
}
preload() {
this.load.spritesheet("warrior", "warrior.png", { frameWidth: 12, frameHeight: 15 });
this.load.spritesheet("rat", "rat.png", { frameWidth: 16, frameHeight: 15 });
this.load.spritesheet("bat", "bat.png", { frameWidth: 15, frameHeight: 15 });
}
create() {
this.cursors = this.input.keyboard!.createCursorKeys();
@@ -217,6 +223,9 @@ export class GameScene extends Phaser.Scene {
if (ev.type === "damaged") {
console.log("Showing damage:", ev.amount, "at", ev.x, ev.y);
this.dungeonRenderer.showDamage(ev.x, ev.y, ev.amount);
} else if (ev.type === "killed") {
console.log("Showing corpse for:", ev.victimType, "at", ev.x, ev.y);
this.dungeonRenderer.spawnCorpse(ev.x, ev.y, ev.victimType || "rat");
}
}