diff --git a/core/src/ru/deadsoftware/cavecraft/game/objects/Block.java b/core/src/ru/deadsoftware/cavecraft/game/objects/Block.java
index 77810e95084e6ef1b1f8c54a0bc588b53faadfa4..44619f0654f3c9e2a22adbee85e66e28037962ba 100644 (file)
public class Block {
- private Rectangle rect;
- private TextureRegion texture;
+ private int x,y,w,h;
+ private int texture;
- 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) {
+ this(0,0,16,16,texture, true, false, false);
}
- public Block(int x, int y, int w, int h, TextureRegion texture, boolean collision, boolean foreground) {
- rect = new Rectangle(x,y,w,h);
+ public Block(int texture, boolean collision, boolean background, boolean transparent) {
+ this(0,0,16,16,texture, collision, background, transparent);
+ }
+
+ 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.foreground = foreground;
+ this.background = background;
+ this.transparent = transparent;
}
- public TextureRegion getTexture() {
+ public int getTexture() {
return texture;
}
- public Rectangle getRect() {
- return rect;
- }
-
- public int getX() {
- return (int)rect.x;
+ public Rectangle getRect(int x, int y) {
+ x*=16;
+ y*=16;
+ return new Rectangle(x+this.x, y+this.y, w, h);
}
- public int getY() {
- return (int)rect.y;
+ public boolean toJump() {
+ return (y<8 && collision);
}
- public int getWidth() {
- return (int)rect.width;
- }
-
- public int getHeight() {
- return (int)rect.height;
- }
}