From 4ada07bcd4a9f1f9caebafb1d0d9822b2cd04fc6 Mon Sep 17 00:00:00 2001 From: Recrown Date: Sun, 4 Jun 2017 02:44:33 -0500 Subject: [PATCH] continued work on flake entityy --- .../polyjet/entity/ally/PolyJetEntity.java | 1 - .../src/zero1hd/polyjet/entity/enemies/Flake.java | 15 +++++++++++++++ .../zero1hd/polyjet/ui/windows/SpawnerWindow.java | 4 ++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/core/src/zero1hd/polyjet/entity/ally/PolyJetEntity.java b/core/src/zero1hd/polyjet/entity/ally/PolyJetEntity.java index a6fdc64..7507045 100755 --- a/core/src/zero1hd/polyjet/entity/ally/PolyJetEntity.java +++ b/core/src/zero1hd/polyjet/entity/ally/PolyJetEntity.java @@ -6,7 +6,6 @@ import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.g2d.Batch; import com.badlogic.gdx.graphics.g2d.ParticleEffect; import com.badlogic.gdx.math.Rectangle; -import com.badlogic.gdx.math.Vector3; import com.badlogic.gdx.scenes.scene2d.Actor; import com.badlogic.gdx.scenes.scene2d.actions.Actions; diff --git a/core/src/zero1hd/polyjet/entity/enemies/Flake.java b/core/src/zero1hd/polyjet/entity/enemies/Flake.java index bdee48d..cfee282 100755 --- a/core/src/zero1hd/polyjet/entity/enemies/Flake.java +++ b/core/src/zero1hd/polyjet/entity/enemies/Flake.java @@ -1,12 +1,14 @@ package zero1hd.polyjet.entity.enemies; import com.badlogic.gdx.graphics.Texture; +import com.badlogic.gdx.graphics.g2d.Batch; import com.badlogic.gdx.math.MathUtils; import com.badlogic.gdx.math.Rectangle; import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.scenes.scene2d.Actor; import com.badlogic.gdx.utils.Pool.Poolable; +import zero1hd.polyjet.Polyjet; import zero1hd.polyjet.entity.Entities; import zero1hd.polyjet.entity.Entity; @@ -35,6 +37,7 @@ public class Flake extends Actor implements Poolable, Entity { hitbox.setSize(getWidth(), getHeight()); center.set(getWidth()/2f, getHeight()/2f); rot.set(MathUtils.sinDeg(angle), MathUtils.cosDeg(angle)); + debug(); } @Override @@ -46,13 +49,24 @@ public class Flake extends Actor implements Poolable, Entity { } 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()) { + timer = 0; + } super.act(delta); } + @Override + public void draw(Batch batch, float parentAlpha) { + batch.draw(texture, getX(), getY()); + super.draw(batch, parentAlpha); + } + @Override public void collided(Entity entity) { } @@ -89,6 +103,7 @@ 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/ui/windows/SpawnerWindow.java b/core/src/zero1hd/polyjet/ui/windows/SpawnerWindow.java index 84e936f..4fd7f15 100755 --- a/core/src/zero1hd/polyjet/ui/windows/SpawnerWindow.java +++ b/core/src/zero1hd/polyjet/ui/windows/SpawnerWindow.java @@ -97,12 +97,16 @@ public class SpawnerWindow extends Window { case FLAKE: Shard[] shards = new Shard[(int) mod4.getValue()]; for (int i = 0; i < shards.length; i++) { + shards[i] = (Shard) ec.retrieveEntity(Entities.SHARD); shards[i].init(coords.x, coords.y, 360f/shards.length*i, 0f, (int) mod3.getValue()); 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); default: break; }