Advertisement
Guest User

Untitled

a guest
Mar 11th, 2017
242
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. public class Inventory {
  2.  
  3. public boolean open = false;
  4. public Tile selected;
  5. public ArrayList<Slot> slots = new ArrayList<Slot>();
  6.  
  7. public void create() {
  8. selected = new Tile(Game.misc.getImage("inventory/slot_selected"), 100, 900, 64, false, 8);
  9.  
  10. // Create visible slots
  11. for (int i = 0; i < 16; i++) {
  12. new Slot(100 + (i * 64), 900, true);
  13. }
  14. // Create hidden slots
  15. for (int i = 0; i < 3; i++) {
  16. for (int j = 0; j < 16; j++) {
  17. new Slot(100 + (j * 64), 800 + (i * 64), false, false);
  18. }
  19. }
  20. }
  21.  
  22. public void update() {
  23. if (KeyboardEvents.pressedKeyWithCooldown(KeyEvent.VK_I, new Cooldown(10))) {
  24. if (open == false) {
  25. open = true;
  26. for (int i = 0; i < slots.size(); i++) {
  27. Game.tiles.get(i).visable = false;
  28. System.out.println(Game.tiles.get(i+2).visable + ", " + slots.get(i).visable);
  29. }
  30. } else {
  31. open = false;
  32. for (int i = 0; i < slots.size(); i++) {
  33. slots.get(i).visable = true;
  34. }
  35. }
  36. }
  37. }
  38.  
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement