-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathPlayer.java
More file actions
86 lines (59 loc) · 1.54 KB
/
Player.java
File metadata and controls
86 lines (59 loc) · 1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.function.Consumer;
import javax.imageio.ImageIO;
import java.io.IOException;
import java.net.URL;
import java.util.Random;
import java.util.ArrayList;
import java.util.List;
public class Player extends Main {
private Location location;
private int health;
private List<Items> inventory;
private Ending Ending;
private Ui Ui;
public Player(Location initialLocation) {
this.location = initialLocation;
//Setting default health to 10 max health
this.health = 10;
this.inventory = new ArrayList<>();
}
// chance to encounter enteraction that deplete health.
public Location getLocation() {
return location;
}
public void setLocation(Location location) {
this.location = location;
}
public int getHealth() {
return health;
}
public void setHealth(int health) {
this.health = health;
}
public List<Items> getInventory() {
return inventory;
}
//moving (add to button)
public void move(Location newLocation) {
this.location = newLocation;
}
public boolean isAlive() {
return health > 0;
}
public void collectItem(Items item) {
inventory.add(item);
//popup confirmation box
}
public void useItem(Items item) {
}
public Player () {
}
public static void add(String item) {
// TODO Auto-generated method stub
}
}