X-Git-Url: http://deadsoftware.ru/gitweb?a=blobdiff_plain;f=core%2Fsrc%2Fru%2Fdeadsoftware%2Fcavecraft%2Fgame%2Fobjects%2FBlock.java;h=8d27235a4fc941f87309855bf6c85e6e09538ed9;hb=8c0966b107ebbf261f8aa9c516fb90b0d9d230e5;hp=77810e95084e6ef1b1f8c54a0bc588b53faadfa4;hpb=3170dad22d4643ae39e66a0d6a445df198418e73;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 77810e9..8d27235 100644 --- a/core/src/ru/deadsoftware/cavecraft/game/objects/Block.java +++ b/core/src/ru/deadsoftware/cavecraft/game/objects/Block.java @@ -1,47 +1,65 @@ package ru.deadsoftware.cavecraft.game.objects; -import com.badlogic.gdx.graphics.g2d.TextureRegion; import com.badlogic.gdx.math.Rectangle; public class Block { - private Rectangle rect; - private TextureRegion texture; + private int x, y, w, h; + private int tex; + private int hp, drop; - public boolean collision, foreground; + public boolean coll, bg, tp, rb; - public Block(int x, int y, int w, int h, TextureRegion texture) { - this(x,y,w,h,texture, true, false); + public Block(int tex, int hp, int drop) { + this(0, 0, 16, 16, tex, hp, drop, true, false, 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); - this.texture = texture; - this.collision = collision; - this.foreground = foreground; + public Block(int tex, int hp, int drop, boolean coll, boolean bg, boolean tp) { + this(0, 0, 16, 16, tex, hp, drop, coll, bg, tp, false); } - public TextureRegion getTexture() { - return texture; + public Block(int tex, int hp, int drop, boolean coll, boolean bg, boolean tp, boolean rb) { + this(0, 0, 16, 16, tex, hp, drop, coll, bg, tp, rb); } - public Rectangle getRect() { - return rect; + public Block(int x, int y, int w, int h, int tex, int hp, int drop, boolean coll, boolean bg, boolean tp) { + this(x, y, w, h, tex, hp, drop, coll, bg, tp, false); } - public int getX() { - return (int)rect.x; + public Block(int x, int y, int w, int h, int tex, int hp, int drop, boolean coll, boolean bg, boolean tp, boolean rb) { + this.x = x; + this.y = y; + this.w = w; + this.h = h; + this.tex = tex; + this.hp = hp; + this.drop = drop; + this.coll = coll; + this.bg = bg; + this.tp = tp; + this.rb = rb; } - public int getY() { - return (int)rect.y; + public int getTex() { + return tex; } - public int getWidth() { - return (int)rect.width; + public int getHp() { + return hp; } - public int getHeight() { - return (int)rect.height; + public int getDrop() { + return drop; } + + public Rectangle getRect(int x, int y) { + x *= 16; + y *= 16; + return new Rectangle(x + this.x, y + this.y, w, h); + } + + public boolean toJump() { + return (y < 8 && coll); + } + }