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

@@ -148,6 +148,7 @@ public class GamePanel extends JPanel implements Runnable {
}
}
for(Entity entity : iTile[currentMap.getIndex()]) if(entity != null) entity.update();
eManager.update();
break;
case PAUSE:
break;

View File

@@ -194,7 +194,11 @@ public class UI {
for(int i = 0; i < entity.inventory.size(); i++) {
// EQUIP CURSOR
if(entity.inventory.get(i) == entity.currentWeapon || entity.inventory.get(i) == entity.currentShield) {
if(
entity.inventory.get(i) == entity.currentWeapon ||
entity.inventory.get(i) == entity.currentShield ||
entity.inventory.get(i) == entity.currentLight
) {
graphics2d.setColor(new Color(240, 190,90));
graphics2d.fillRoundRect(slotX, slotY, panel.tileSize, panel.tileSize, 10, 10);
}

View File

@@ -10,6 +10,7 @@ public enum EntityType {
PICKUP,
PROJECTILE,
WEAPON,
LIGHT,
SHIELD;
public enum WeaponType {

View File

@@ -54,6 +54,11 @@ public class AssetSetter {
panel.obj[Map.OVERWORLD.getIndex()][i].worldX = panel.tileSize*17;
panel.obj[Map.OVERWORLD.getIndex()][i].worldY = panel.tileSize*21;
i++;
panel.obj[Map.OVERWORLD.getIndex()][i] = new LanternObj(panel);
panel.obj[Map.OVERWORLD.getIndex()][i].worldX = panel.tileSize*18;
panel.obj[Map.OVERWORLD.getIndex()][i].worldY = panel.tileSize*20;
i++;
}
public void setNPC() {