DEADSOFTWARE

Fix code style
[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 texture;
9 private int hp, drop;
11 public boolean collision, background, transparent;
13 public Block(int texture, int hp, int drop) {
14 this(0, 0, 16, 16, texture, hp, drop, true, false, false);
15 }
17 public Block(int texture, int hp, int drop, boolean collision, boolean background, boolean transparent) {
18 this(0, 0, 16, 16, texture, hp, drop, collision, background, transparent);
19 }
21 public Block(int x, int y, int w, int h, int texture, int hp, int drop, boolean collision, boolean background, boolean transparent) {
22 this.x = x;
23 this.y = y;
24 this.w = w;
25 this.h = h;
26 this.texture = texture;
27 this.hp = hp;
28 this.drop = drop;
29 this.collision = collision;
30 this.background = background;
31 this.transparent = transparent;
32 }
34 public int getTexture() {
35 return texture;
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 && collision);
54 }
56 }