add BigRockNPC and IronDoorObj; update AssetSetter to include new NPC and interactive tiles

This commit is contained in:
2026-03-24 13:01:21 +01:00
parent 7bbbd8f72b
commit aadd01f8ec
18 changed files with 388 additions and 40 deletions

View File

@@ -6,6 +6,7 @@ import de.miaurizius.jgame2d.core.enums.EntityType;
import de.miaurizius.jgame2d.core.enums.GameState;
import de.miaurizius.jgame2d.core.handlers.KeyHandler;
import de.miaurizius.jgame2d.entity.item.KeyObj;
import de.miaurizius.jgame2d.entity.item.LanternObj;
import de.miaurizius.jgame2d.entity.item.ShieldWoodObj;
import de.miaurizius.jgame2d.entity.item.SwordNormalObj;
import de.miaurizius.jgame2d.entity.projectile.FireballObj;
@@ -257,14 +258,18 @@ public class Player extends Entity {
panel.iTile[panel.currentMap.getIndex()][index].life--;
panel.iTile[panel.currentMap.getIndex()][index].invincible = true;
generateParticle(panel.iTile[panel.currentMap.getIndex()][index], panel.iTile[panel.currentMap.getIndex()][index]);
panel.iTile[panel.currentMap.getIndex()][index].checkDrop();
if(panel.iTile[panel.currentMap.getIndex()][index].life == 0) panel.iTile[panel.currentMap.getIndex()][index] = panel.iTile[panel.currentMap.getIndex()][index].getDestroyedForm();
}
public void interactNPC(int index) {
if(index == 999) return;
//if(!panel.keyH.spacePressed) return; //Only uncomment if text should only appear if player hits space
attackCancel = true;
panel.npc[panel.currentMap.getIndex()][index].speak();
if(panel.keyH.spacePressed) {
attackCancel = true;
panel.npc[panel.currentMap.getIndex()][index].speak();
return;
}
panel.npc[panel.currentMap.getIndex()][index].move(direction);
}
public void speak() {
//This method only exists for character specific things later...
@@ -362,6 +367,7 @@ public class Player extends Entity {
inventory.add(currentWeapon);
inventory.add(currentShield);
inventory.add(new KeyObj(panel));
inventory.add(new LanternObj(panel));
}
public void setDialogue() {
dialogue[0][0] = "You are level " + level + " now!\nYou feel stronger!";
@@ -417,6 +423,16 @@ public class Player extends Entity {
attackRight1 = initEntitySprites("player/attack/boy_axe_right_1", panel.tileSize * 2, panel.tileSize);
attackRight2 = initEntitySprites("player/attack/boy_axe_right_2", panel.tileSize * 2, panel.tileSize);
break;
case PICKAXE:
attackUp1 = initEntitySprites("player/attack/boy_pick_up_1", panel.tileSize, panel.tileSize * 2);
attackUp2 = initEntitySprites("player/attack/boy_pick_up_2", panel.tileSize, panel.tileSize * 2);
attackDown1 = initEntitySprites("player/attack/boy_pick_down_1", panel.tileSize, panel.tileSize * 2);
attackDown2 = initEntitySprites("player/attack/boy_pick_down_2", panel.tileSize, panel.tileSize * 2);
attackLeft1 = initEntitySprites("player/attack/boy_pick_left_1", panel.tileSize * 2, panel.tileSize);
attackLeft2 = initEntitySprites("player/attack/boy_pick_left_2", panel.tileSize * 2, panel.tileSize);
attackRight1 = initEntitySprites("player/attack/boy_pick_right_1", panel.tileSize * 2, panel.tileSize);
attackRight2 = initEntitySprites("player/attack/boy_pick_right_2", panel.tileSize * 2, panel.tileSize);
break;
}
}
public void getGuardImages() {