DEADSOFTWARE

d92b846250571521dfd33f3f85cd826a35f3f312
[cavedroid.git] / core / src / ru / deadsoftware / cavecraft / game / objects / Drop.java
1 package ru.deadsoftware.cavecraft.game.objects;
3 import com.badlogic.gdx.math.Rectangle;
4 import com.badlogic.gdx.math.Vector2;
6 import java.io.Serializable;
8 public class Drop implements Serializable {
9 private int id;
10 public boolean pickedUp = false;
11 public Vector2 move, position;
13 public Drop(float x, float y, int id) {
14 this.id = id;
15 position = new Vector2(x, y);
16 move = new Vector2(0, -1);
17 }
19 public void pickUpDrop(Player pl) {
20 for (int i = 0; i < pl.inv.length; i++) {
21 if (pl.inv[i] == 0 || pl.inv[i] == id) {
22 pl.inv[i] = id;
23 pickedUp = true;
24 break;
25 }
26 }
27 }
29 public int getId() {
30 return id;
31 }
33 public Rectangle getRect() {
34 return new Rectangle(position.x, position.y, 8, 8);
35 }
37 }