DEADSOFTWARE

Some refactor
[cavedroid.git] / core / src / ru / deadsoftware / cavecraft / game / objects / Block.java
1 package ru.deadsoftware.cavecraft.game.objects;
3 import com.badlogic.gdx.math.Rectangle;
5 public class Block {
7 private int x, y, w, h;
8 private int tex;
9 private int hp, drop;
11 public boolean coll, bg, tp;
13 public Block(int tex, int hp, int drop) {
14 this(0, 0, 16, 16, tex, hp, drop, true, false, false);
15 }
17 public Block(int tex, int hp, int drop, boolean coll, boolean bg, boolean tp) {
18 this(0, 0, 16, 16, tex, hp, drop, coll, bg, tp);
19 }
21 public Block(int x, int y, int w, int h, int tex, int hp, int drop, boolean coll, boolean bg, boolean tp) {
22 this.x = x;
23 this.y = y;
24 this.w = w;
25 this.h = h;
26 this.tex = tex;
27 this.hp = hp;
28 this.drop = drop;
29 this.coll = coll;
30 this.bg = bg;
31 this.tp = tp;
32 }
34 public int getTex() {
35 return tex;
36 }
38 public int getHp() {
39 return hp;
40 }
42 public int getDrop() {
43 return drop;
44 }
46 public Rectangle getRect(int x, int y) {
47 x *= 16;
48 y *= 16;
49 return new Rectangle(x + this.x, y + this.y, w, h);
50 }
52 public boolean toJump() {
53 return (y < 8 && coll);
54 }
56 }