DEADSOFTWARE

Add more blocks
[cavedroid.git] / core / src / ru / deadsoftware / cavecraft / game / objects / Block.java
index e888b212fe3d0b7d8ac0b9690dba9757022eac01..4fa47369fd151f2760ea314e58e9eadb2009ec43 100644 (file)
@@ -5,35 +5,38 @@ import com.badlogic.gdx.math.Rectangle;
 
 public class Block {
 
-    private Rectangle rect;
-    private TextureRegion texture;
+    private int x,y,w,h;
+    private int texture;
 
-    public Block(int x, int y, int w, int h, TextureRegion texture) {
-        rect = new Rectangle(x,y,w,h);
-        this.texture = texture;
-    }
+    public boolean collision, background, transparent;
 
-    public TextureRegion getTexture() {
-        return texture;
+    public Block(int texture) {
+        this(0,0,16,16,texture, true, false, false);
     }
 
-    public Rectangle getRect() {
-        return rect;
+    public Block(int texture, boolean collision, boolean background, boolean transparent) {
+        this(0,0,16,16,texture, collision, background, transparent);
     }
 
-    public int getX() {
-        return (int)rect.x;
+    public Block(int x, int y, int w, int h, int texture, boolean collision, boolean background, boolean transparent) {
+        this.x = x;
+        this.y = y;
+        this.w = w;
+        this.h = h;
+        this.texture = texture;
+        this.collision = collision;
+        this.background = background;
+        this.transparent = transparent;
     }
 
-    public int getY() {
-        return (int)rect.y;
+    public int getTexture() {
+        return texture;
     }
 
-    public int getWidth() {
-        return (int)rect.width;
+    public Rectangle getRect(int x, int y) {
+        x*=16;
+        y*=16;
+        return new Rectangle(x+this.x, y+this.y, w, h);
     }
 
-    public int getHeight() {
-        return (int)rect.height;
-    }
 }