Browse Source

Created player class

remotes/origin/locations
David Hermann 2 years ago
parent
commit
6e24f5651b
  1. 51
      src/main/java/org/bitbiome/classes/Player.java

51
src/main/java/org/bitbiome/classes/Player.java

@ -0,0 +1,51 @@
package org.bitbiome.classes;
import java.util.ArrayList;
public class Player {
private String name;
private float hp;
private Location location;
private ArrayList<Item> inventory;
public Player(String name) {
this.name = name;
hp = 100.0F;
location = CreateLocations.createForest();
inventory = new ArrayList<>();
}
public String getName() {
return name;
}
public ArrayList<Item> getInventory() {
return inventory;
}
public float getHp() {
return hp;
}
public Location getLocation() {
return location;
}
public void setLocation(Location location) {
this.location = location;
}
public void setHp(float hp) {
this.hp = hp;
}
public boolean addToInventory(Item item) {
return inventory.add(item);
}
public boolean removeFromInventory(Item item) {
return inventory.remove(item);
}
}
Loading…
Cancel
Save