make heart collectable
This commit is contained in:
@@ -48,6 +48,8 @@ public class Player extends Entity {
|
||||
|
||||
// DEFAULT
|
||||
public void update() {
|
||||
if(life > maxLife) life = maxLife;
|
||||
|
||||
if(attacking) {
|
||||
attacking();
|
||||
return;
|
||||
@@ -124,14 +126,22 @@ public class Player extends Entity {
|
||||
|
||||
// INTERACTION
|
||||
public void pickObject(int index) {
|
||||
if(index == 999) return;
|
||||
if(inventory.size() == maxInvSize) {
|
||||
panel.ui.addMessage("Your inventory is full!");
|
||||
return;
|
||||
if(index == 999 || panel.obj[index] == null) return;
|
||||
|
||||
// PICKUP ONLY
|
||||
if(panel.obj[index].type == EntityType.PICKUP) {
|
||||
panel.obj[index].use(this);
|
||||
}
|
||||
// INVENTORY ITEMS
|
||||
else {
|
||||
if(inventory.size() == maxInvSize) {
|
||||
panel.ui.addMessage("Your inventory is full!");
|
||||
return;
|
||||
}
|
||||
inventory.add(panel.obj[index]);
|
||||
panel.playSE(1);
|
||||
panel.ui.addMessage("Picked up " + panel.obj[index].name + "!");
|
||||
}
|
||||
inventory.add(panel.obj[index]);
|
||||
panel.playSE(1);
|
||||
panel.ui.addMessage("Picked up " + panel.obj[index].name + "!");
|
||||
panel.obj[index] = null;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user