forked from redomar/JavaGame
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInventory.java
More file actions
60 lines (54 loc) · 1.42 KB
/
Inventory.java
File metadata and controls
60 lines (54 loc) · 1.42 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
package com.redomar.game.objects;
import com.redomar.game.Game;
public class Inventory {
public static int x;
public static int y;
public static boolean open = false;
public static boolean closing;
public static boolean reset;
public static boolean enabled;
private static InventoryWindow inv_window = new InventoryWindow();
public static void activate() {
x = (int) Game.getPlayer().getX();
y = (int) Game.getPlayer().getY();
if (Game.getLevel().getTile(x >> 3, y >> 3).getId() == 8) {
if (enabled) {
if (!open) {
if (!closing) {
System.out.println("Opened\nInside this Bag their is:"
+ inside());
open = true;
Game.getPlayer().setMoving(false);
Game.getInput().untoggle(true);
inv_window.start();
}
} else {
if (closing) {
Game.getPlayer().setMoving(true);
Game.getInput().untoggle(false);
inv_window.stop();
inv_window.getFrame().setVisible(false);
inv_window.getFrame().stopFrame();
if (Game.getLevel().getTile(x >> 3, y >> 3).getId() == 8) {
reset = true;
System.out.println("rest");
}
}
}
}
} else {
if (open == true || reset == true || closing == true) {
reset = false;
open = false;
closing = false;
}
}
}
private static String inside() {
String items = " ";
for (Items item : Items.values()) {
items = items + item.toString() + ", ";
}
return items;
}
}