X-Git-Url: http://deadsoftware.ru/gitweb?a=blobdiff_plain;f=core%2Fsrc%2Fru%2Fdeadsoftware%2Fcavecraft%2Fgame%2Fobjects%2FDrop.java;h=fa60f6b60d67f9eec9385988f66da77537c7eed2;hb=be2690f1dee10f68a5ce6d576ace13c825ac5d15;hp=5ff36e476584f6eaa9ac34733d76ba550df0d9ea;hpb=0b8922bfbb2bbec067b532ecb7912f6afe02c4ef;p=cavedroid.git diff --git a/core/src/ru/deadsoftware/cavecraft/game/objects/Drop.java b/core/src/ru/deadsoftware/cavecraft/game/objects/Drop.java index 5ff36e4..fa60f6b 100644 --- a/core/src/ru/deadsoftware/cavecraft/game/objects/Drop.java +++ b/core/src/ru/deadsoftware/cavecraft/game/objects/Drop.java @@ -7,29 +7,31 @@ import java.io.Serializable; public class Drop implements Serializable { private int id; - public Vector2 move, position; - - public static void pickUpDrop(Player pl, int id) { - for (int i = 0; i < pl.inventory.length; i++) { - if (pl.inventory[i] == 0) { - pl.inventory[i] = id; - break; - } - } - } + public boolean pickedUp = false; + public Vector2 move, pos; public Drop(float x, float y, int id) { this.id = id; - position = new Vector2(x, y); + pos = new Vector2(x, y); move = new Vector2(0, -1); } + public void pickUpDrop(Player pl) { + for (int i = 0; i < pl.inv.length; i++) { + if (pl.inv[i] == 0 || pl.inv[i] == id) { + pl.inv[i] = id; + pickedUp = true; + break; + } + } + } + public int getId() { return id; } public Rectangle getRect() { - return new Rectangle(position.x, position.y, 8, 8); + return new Rectangle(pos.x, pos.y, 8, 8); } }