add lantern object and implement light management in player and environment

This commit is contained in:
2025-12-13 13:44:52 +01:00
parent 7ee7614c6c
commit 2105a0e8af
9 changed files with 86 additions and 27 deletions

View File

@@ -20,6 +20,7 @@ public class Player extends Entity {
// STATE
public boolean attackCancel;
public boolean lightUpdated;
public Player(GamePanel panel, KeyHandler keyH) {
super(panel);
@@ -289,6 +290,10 @@ public class Player extends Entity {
currentShield = selectedItem;
getDefense();
}
if(selectedItem.type == EntityType.LIGHT) {
if(currentLight == selectedItem) currentLight = null; else currentLight = selectedItem;
lightUpdated = true;
}
if(selectedItem.consumable)
if(selectedItem.use(this))
if(selectedItem.amt > 1) selectedItem.amt--; else inventory.remove(selectedItem);