diff --git a/core/src/zero1hd/polyjet/entity/enemies/Flake.java b/core/src/zero1hd/polyjet/entity/enemies/Flake.java index cfee282..60221b5 100755 --- a/core/src/zero1hd/polyjet/entity/enemies/Flake.java +++ b/core/src/zero1hd/polyjet/entity/enemies/Flake.java @@ -30,29 +30,26 @@ public class Flake extends Actor implements Poolable, Entity { public void init(float x, float y, float rate, float fuse, float angle, Shard... shards) { this.shards = shards; - setPosition(x, y); setSize(1f, 1f); this.rate = rate; this.timer = fuse; hitbox.setSize(getWidth(), getHeight()); center.set(getWidth()/2f, getHeight()/2f); + setPosition(x-center.x, y-center.y); rot.set(MathUtils.sinDeg(angle), MathUtils.cosDeg(angle)); - debug(); } @Override public void act(float delta) { - moveBy(rot.x*delta*rate, rot.y*delta*rate); if (timer > 0) { timer -= delta; } - + moveBy(rot.x*delta*rate, rot.y*delta*rate); + for (int i = 0; i < shards.length; i++) { - shards[i].debug(); shards[i].setPosition(getX()+center.x-shards[i].getCenter().x, getY()+center.y-shards[i].getCenter().y); } - hitbox.setPosition(getX(), getY()); if (getX() > Polyjet.GAME_AREA_WIDTH || getY() > Polyjet.GAME_AREA_HEIGHT || getX() < 0-getWidth() || getY() < 0-getHeight()) { @@ -63,7 +60,7 @@ public class Flake extends Actor implements Poolable, Entity { @Override public void draw(Batch batch, float parentAlpha) { - batch.draw(texture, getX(), getY()); + batch.draw(texture, getX(), getY(), getWidth(), getHeight()); super.draw(batch, parentAlpha); } @@ -103,7 +100,6 @@ public class Flake extends Actor implements Poolable, Entity { setSize(0, 0); center.set(0, 0); rot.set(0, 0); - System.out.println("iscleaned"); } } diff --git a/core/src/zero1hd/polyjet/entity/enemies/Shard.java b/core/src/zero1hd/polyjet/entity/enemies/Shard.java index c0ab8fc..187b151 100755 --- a/core/src/zero1hd/polyjet/entity/enemies/Shard.java +++ b/core/src/zero1hd/polyjet/entity/enemies/Shard.java @@ -40,7 +40,7 @@ public class Shard extends Actor implements Entity, Poolable { setSize(2f, 2f); hitbox.setSize(getWidth(), getHeight()); center.set(getWidth()/2f, getHeight()/2f); - setPosition(x, y); + setPosition(x-center.x, y-center.y); sprite.setOrigin(sprite.getWidth()/2f, sprite.getHeight()/2f); } @@ -111,11 +111,6 @@ public class Shard extends Actor implements Entity, Poolable { this.rate = rate; } - @Override - public void setPosition(float x, float y) { - super.setPosition(x-center.x, y-center.y); - } - public Vector2 getCenter() { return center; } diff --git a/core/src/zero1hd/polyjet/ui/windows/SpawnerWindow.java b/core/src/zero1hd/polyjet/ui/windows/SpawnerWindow.java index 4fd7f15..ea6628c 100755 --- a/core/src/zero1hd/polyjet/ui/windows/SpawnerWindow.java +++ b/core/src/zero1hd/polyjet/ui/windows/SpawnerWindow.java @@ -102,8 +102,6 @@ public class SpawnerWindow extends Window { stage.addActor(shards[i]); } - System.out.println("test"); - Flake flake = (Flake) entity; flake.init(coords.x, coords.y, mod1.getValue(), mod3.getValue(), mod2.getValue()/mod2.getMaxValue()*360f, shards); stage.addActor(flake);