added game over screen

This commit is contained in:
2025-12-12 12:26:32 +01:00
parent 785a76942e
commit 5dd43b6f9d
7 changed files with 123 additions and 56 deletions

View File

@@ -125,6 +125,11 @@ public class Player extends Entity {
invincible = false;
invincibleCount = 0;
}
if(life <= 0) {
panel.gameState = GameState.GAMEOVER;
panel.playSE(12);
}
}
// INTERACTION
@@ -241,7 +246,7 @@ public class Player extends Entity {
super.speak();
}
// BACKGROUND CHECKS
// BACKGROUND JOBS
public void checkLevelUp() {
if(exp < nextLevelExp) return;
level++;
@@ -274,6 +279,15 @@ public class Player extends Entity {
inventory.remove(itemIndex);
}
}
public void setDefaultPositions() {
worldX = panel.tileSize * 23;
worldY = panel.tileSize * 21;
direction = Direction.DOWN;
}
public void restoreLife() {
life = maxLife;
invincible = false;
}
// SETTING THINGS UP
public void setDefaultValues() {
@@ -298,6 +312,7 @@ public class Player extends Entity {
defense = getDefense();
// INVENTORY
inventory.clear();
inventory.add(currentWeapon);
inventory.add(currentShield);
}