enhance chest object handling and save/load functionality
This commit is contained in:
@@ -8,13 +8,10 @@ import de.miaurizius.jgame2d.entity.Entity;
|
||||
public class ChestObj extends Entity {
|
||||
|
||||
GamePanel panel;
|
||||
Entity loot;
|
||||
boolean opened;
|
||||
|
||||
public ChestObj(GamePanel panel, Entity loot) {
|
||||
public ChestObj(GamePanel panel) {
|
||||
super(panel);
|
||||
this.panel = panel;
|
||||
this.loot = loot;
|
||||
type = EntityType.OBSTACLE;
|
||||
name = "chest";
|
||||
|
||||
@@ -31,11 +28,16 @@ public class ChestObj extends Entity {
|
||||
solidAreaDefaultY = solidArea.y;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLoot(Entity loot) {
|
||||
this.loot = loot;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void interact() {
|
||||
panel.gameState = GameState.DIALOGUE;
|
||||
|
||||
if(opened) {
|
||||
if(this.opened) {
|
||||
panel.ui.currentDialogue = "It's already empty...";
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user