DEADSOFTWARE

Add more blocks
[cavedroid.git] / core / src / ru / deadsoftware / cavecraft / game / objects / Block.java
1 package ru.deadsoftware.cavecraft.game.objects;
3 import com.badlogic.gdx.graphics.g2d.TextureRegion;
4 import com.badlogic.gdx.math.Rectangle;
6 public class Block {
8 private int x,y,w,h;
9 private int texture;
11 public boolean collision, background, transparent;
13 public Block(int texture) {
14 this(0,0,16,16,texture, true, false, false);
15 }
17 public Block(int texture, boolean collision, boolean background, boolean transparent) {
18 this(0,0,16,16,texture, collision, background, transparent);
19 }
21 public Block(int x, int y, int w, int h, int texture, 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.collision = collision;
28 this.background = background;
29 this.transparent = transparent;
30 }
32 public int getTexture() {
33 return texture;
34 }
36 public Rectangle getRect(int x, int y) {
37 x*=16;
38 y*=16;
39 return new Rectangle(x+this.x, y+this.y, w, h);
40 }
42 }