DEADSOFTWARE

a1696f64b340a7c3ed979cf3c3e5b359362dfb0e
[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 TextureRegion texture;
11 public boolean collision, foreground;
13 public Block(int x, int y, int w, int h, TextureRegion texture) {
14 this(x,y,w,h,texture, true, false);
15 }
17 public Block(int x, int y, int w, int h, TextureRegion texture, boolean collision, boolean foreground) {
18 this.x = x;
19 this.y = y;
20 this.w = w;
21 this.h = h;
22 this.texture = texture;
23 this.collision = collision;
24 this.foreground = foreground;
25 }
27 public TextureRegion getTexture() {
28 return texture;
29 }
31 public Rectangle getRect(int x, int y) {
32 x*=16;
33 y*=16;
34 return new Rectangle(x+this.x, y+this.y, w, h);
35 }
37 }