Add character (warrior) and rat/bat sprites
This commit is contained in:
@@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user