feat: add upgrade scrolls

This commit is contained in:
Peter Stockings
2026-01-23 23:26:55 +11:00
parent e130e6d174
commit c415becc38
8 changed files with 412 additions and 4 deletions

View File

@@ -36,6 +36,12 @@ export class ItemSpriteFactory {
sprite.setScale(scale);
container.add(sprite);
// Add upgrade level badge if item has been upgraded
if (item.upgradeLevel && item.upgradeLevel > 0) {
const badge = this.createUpgradeBadge(scene, item.upgradeLevel, scale);
container.add(badge);
}
return container;
}
@@ -109,6 +115,31 @@ export class ItemSpriteFactory {
return variant?.glowColor ?? null;
}
/**
* Creates a badge displaying the upgrade level (e.g., "+1").
*/
private static createUpgradeBadge(
scene: Phaser.Scene,
level: number,
scale: number
): Phaser.GameObjects.Text {
// Position at top-right corner, slightly inset
const offset = 5 * scale;
// Level text with strong outline for readability without background
const text = scene.add.text(offset, -offset, `+${level}`, {
fontSize: `${9 * scale}px`,
color: "#ffd700",
fontStyle: "bold",
fontFamily: "monospace",
stroke: "#000000",
strokeThickness: 3
});
text.setOrigin(0.5);
return text;
}
/**
* Checks if an item has a variant with a glow.
*/