Fix issue where killing an enemy resulted in orb being rendered with rat sprite on top

This commit is contained in:
Peter Stockings
2026-01-04 19:02:51 +11:00
parent b5314986e3
commit 2ca51945fc
4 changed files with 103 additions and 19 deletions

View File

@@ -128,7 +128,8 @@ function handleAttack(w: World, actor: Actor, action: { targetId: EntityId }): S
w.actors.delete(target.id);
// Spawn EXP Orb
const expAmount = target.type === "rat" ? GAME_CONFIG.enemy.ratExp : GAME_CONFIG.enemy.batExp;
const enemyDef = (GAME_CONFIG.enemies as any)[target.type || ""];
const expAmount = enemyDef?.expValue || 0;
const orbId = Math.max(0, ...w.actors.keys(), target.id) + 1;
w.actors.set(orbId, {