DEADSOFTWARE

Fix code style
[cavedroid.git] / core / src / ru / deadsoftware / cavecraft / game / objects / Block.java
index a1696f64b340a7c3ed979cf3c3e5b359362dfb0e..dfd8351dffbd6dc694ee9be42f8263e2c1311d64 100644 (file)
@@ -1,37 +1,56 @@
 package ru.deadsoftware.cavecraft.game.objects;
 
-import com.badlogic.gdx.graphics.g2d.TextureRegion;
 import com.badlogic.gdx.math.Rectangle;
 
 public class Block {
 
-    private int x,y,w,h;
-    private TextureRegion texture;
+    private int x, y, w, h;
+    private int texture;
+    private int hp, drop;
 
-    public boolean collision, foreground;
+    public boolean collision, background, transparent;
 
-    public Block(int x, int y, int w, int h, TextureRegion texture) {
-        this(x,y,w,h,texture, true, false);
+    public Block(int texture, int hp, int drop) {
+        this(0, 0, 16, 16, texture, hp, drop, true, false, false);
     }
 
-    public Block(int x, int y, int w, int h, TextureRegion texture, boolean collision, boolean foreground) {
+    public Block(int texture, int hp, int drop, boolean collision, boolean background, boolean transparent) {
+        this(0, 0, 16, 16, texture, hp, drop, collision, background, transparent);
+    }
+
+    public Block(int x, int y, int w, int h, int texture, int hp, int drop, boolean collision, boolean background, boolean transparent) {
         this.x = x;
         this.y = y;
         this.w = w;
         this.h = h;
         this.texture = texture;
+        this.hp = hp;
+        this.drop = drop;
         this.collision = collision;
-        this.foreground = foreground;
+        this.background = background;
+        this.transparent = transparent;
     }
 
-    public TextureRegion getTexture() {
+    public int getTexture() {
         return texture;
     }
 
+    public int getHp() {
+        return hp;
+    }
+
+    public int getDrop() {
+        return drop;
+    }
+
     public Rectangle getRect(int x, int y) {
-        x*=16;
-        y*=16;
-        return new Rectangle(x+this.x, y+this.y, w, h);
+        x *= 16;
+        y *= 16;
+        return new Rectangle(x + this.x, y + this.y, w, h);
+    }
+
+    public boolean toJump() {
+        return (y < 8 && collision);
     }
 
 }