X-Git-Url: https://deadsoftware.ru/gitweb?a=blobdiff_plain;ds=sidebyside;f=core%2Fsrc%2Fru%2Fdeadsoftware%2Fcavecraft%2Fgame%2Fobjects%2FBlock.java;h=a1696f64b340a7c3ed979cf3c3e5b359362dfb0e;hb=385255cc7b49fbfd3290497367cbc69919b24d4f;hp=e888b212fe3d0b7d8ac0b9690dba9757022eac01;hpb=f988ac987aae5e7dd99721ca4cf044d061153e89;p=cavedroid.git diff --git a/core/src/ru/deadsoftware/cavecraft/game/objects/Block.java b/core/src/ru/deadsoftware/cavecraft/game/objects/Block.java index e888b21..a1696f6 100644 --- a/core/src/ru/deadsoftware/cavecraft/game/objects/Block.java +++ b/core/src/ru/deadsoftware/cavecraft/game/objects/Block.java @@ -5,35 +5,33 @@ import com.badlogic.gdx.math.Rectangle; public class Block { - private Rectangle rect; + private int x,y,w,h; private TextureRegion texture; + public boolean collision, foreground; + public Block(int x, int y, int w, int h, TextureRegion texture) { - rect = new Rectangle(x,y,w,h); + this(x,y,w,h,texture, true, false); + } + + public Block(int x, int y, int w, int h, TextureRegion texture, boolean collision, boolean foreground) { + this.x = x; + this.y = y; + this.w = w; + this.h = h; this.texture = texture; + this.collision = collision; + this.foreground = foreground; } public TextureRegion 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 int getWidth() { - return (int)rect.width; - } - - public int getHeight() { - return (int)rect.height; - } }