X-Git-Url: https://deadsoftware.ru/gitweb?p=cavedroid.git;a=blobdiff_plain;f=core%2Fsrc%2Fru%2Fdeadsoftware%2Fcavecraft%2Fgame%2Fobjects%2FBlock.java;h=4fa47369fd151f2760ea314e58e9eadb2009ec43;hp=e888b212fe3d0b7d8ac0b9690dba9757022eac01;hb=4617ae53584520a741f45770e17a2a253717f83a;hpb=f988ac987aae5e7dd99721ca4cf044d061153e89 diff --git a/core/src/ru/deadsoftware/cavecraft/game/objects/Block.java b/core/src/ru/deadsoftware/cavecraft/game/objects/Block.java index e888b21..4fa4736 100644 --- a/core/src/ru/deadsoftware/cavecraft/game/objects/Block.java +++ b/core/src/ru/deadsoftware/cavecraft/game/objects/Block.java @@ -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; - } }