dodelani dnevnik

This commit is contained in:
2025-12-08 03:15:53 +01:00
parent 860a10a5c3
commit 4c3ee03007
11 changed files with 488 additions and 72 deletions

View File

@@ -12,6 +12,8 @@ class StatsSystem {
this.currentLevel = 1;
this.currentXP = 0;
this.xpToNextLevel = XP_REQUIRED_BASE;
this.score = 0; // GLOBAL SCORE (Za Legacy)
this.totalPlaytime = 0; // Skupni čas igranja (sekunde)
// Stats
this.health = 100;
@@ -39,6 +41,7 @@ class StatsSystem {
update(delta) {
const seconds = delta / 1000;
this.totalPlaytime += seconds; // Track playtime
// Decay
if (this.hunger > 0) {
@@ -94,9 +97,21 @@ class StatsSystem {
this.thirst = Math.min(this.thirst, this.maxThirst);
}
// SCORE & DEATH LOGIC
addScore(points) {
this.score += points;
// console.log(`⭐ Score +${points} (Total: ${this.score})`);
}
die() {
console.log('💀 Player died!');
// SCORE PENALTY (Legacy Cost)
// Igralec NE izgubi farme, ampak izgubi del Dediščine (Točk).
const penalty = Math.floor(this.score * 0.25); // Izguba 25% točk
this.score = Math.max(0, this.score - penalty);
console.log(`📉 Dediščina Oškodovana: -${penalty} Točk (Novo stanje: ${this.score})`);
// Trigger Player Animation
if (this.scene.player) {
this.scene.player.dieAnimation();
@@ -111,16 +126,26 @@ class StatsSystem {
const bg = uiScene.add.rectangle(width / 2, height / 2, width, height, 0x000000, 0.8);
const txt = uiScene.add.text(width / 2, height / 2, 'YOU DIED', {
const txt = uiScene.add.text(width / 2, height / 2 - 50, 'YOU DIED', {
fontSize: '64px', color: '#ff0000', fontStyle: 'bold'
}).setOrigin(0.5);
const sub = uiScene.add.text(width / 2, height / 2 + 20, `Legacy Lost: -${penalty} Score pts`, {
fontSize: '24px', color: '#ffffff'
}).setOrigin(0.5);
const sub2 = uiScene.add.text(width / 2, height / 2 + 60, '(Farm Preserved)', {
fontSize: '18px', color: '#aaaaaa', fontStyle: 'italic'
}).setOrigin(0.5);
// Wait and Respawn
uiScene.time.delayedCall(3000, () => {
if (bg) bg.destroy();
if (txt) txt.destroy();
if (sub) sub.destroy();
if (sub2) sub2.destroy();
// Reset Stats
// Reset Stats (but keep Score penalty)
this.health = 100;
this.hunger = 100;
this.thirst = 100;