added UI with inventory and some notifications and an end screen + timer

This commit is contained in:
2025-11-27 18:32:08 +01:00
parent 67f2eeddf5
commit 521951129b
3 changed files with 97 additions and 3 deletions

View File

@@ -16,7 +16,7 @@ public class Player extends Entity {
public final int screenX;
public final int screenY;
int hasKey = 0;
public int hasKey = 0;
public Player(GamePanel panel, KeyHandler keyH) {
this.panel = panel;
@@ -98,18 +98,27 @@ public class Player extends Entity {
panel.playSE(1);
hasKey++;
panel.obj[index] = null;
panel.ui.showMessage("You got a key!");
break;
case "door":
if(hasKey > 0) {
panel.playSE(3);
panel.obj[index] = null;
hasKey--;
panel.ui.showMessage("You opened the door!");
}
else panel.ui.showMessage("You need a key!");
break;
case "boots":
panel.playSE(2);
speed += 1;
panel.obj[index] = null;
panel.ui.showMessage("Speed up!");
break;
case "chest":
panel.ui.gameFinished = true;
panel.stopMusic();
panel.playSE(4);
break;
}
}