DEADSOFTWARE

Add drop and block breaking
[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 Vector2 move, position;
12 public static void pickUpDrop(Player pl, int id) {
13 for (int i = 0; i < pl.inventory.length; i++) {
14 if (pl.inventory[i] == 0) {
15 pl.inventory[i] = id;
16 break;
17 }
18 }
19 }
21 public Drop(float x, float y, int id) {
22 this.id = id;
23 position = new Vector2(x, y);
24 move = new Vector2(0, -1);
25 }
27 public int getId() {
28 return id;
29 }
31 public Rectangle getRect() {
32 return new Rectangle(position.x, position.y, 8, 8);
33 }
35 }