diff --git a/android/assets/1280x720/shard.png b/android/assets/1280x720/shard.png index c2e203c..381e67d 100755 Binary files a/android/assets/1280x720/shard.png and b/android/assets/1280x720/shard.png differ diff --git a/android/assets/1280x800/shard.png b/android/assets/1280x800/shard.png index e15e7b1..d77b6db 100755 Binary files a/android/assets/1280x800/shard.png and b/android/assets/1280x800/shard.png differ diff --git a/android/assets/1366x768/shard.png b/android/assets/1366x768/shard.png index 33441ac..5e9c4fb 100755 Binary files a/android/assets/1366x768/shard.png and b/android/assets/1366x768/shard.png differ diff --git a/android/assets/1920x1080/shard.png b/android/assets/1920x1080/shard.png index 043870e..3b3c0b6 100755 Binary files a/android/assets/1920x1080/shard.png and b/android/assets/1920x1080/shard.png differ diff --git a/android/assets/1920x1200/shard.png b/android/assets/1920x1200/shard.png index 3a11d8b..2b6bf7a 100755 Binary files a/android/assets/1920x1200/shard.png and b/android/assets/1920x1200/shard.png differ diff --git a/android/assets/2560x1440/shard.png b/android/assets/2560x1440/shard.png index 1a12f0d..da7b114 100755 Binary files a/android/assets/2560x1440/shard.png and b/android/assets/2560x1440/shard.png differ diff --git a/android/assets/3840x2160/shard.png b/android/assets/3840x2160/shard.png index ddda9c7..8fa8673 100755 Binary files a/android/assets/3840x2160/shard.png and b/android/assets/3840x2160/shard.png differ diff --git a/android/assets/800x480/shard.png b/android/assets/800x480/shard.png index 293f3af..bebeb82 100755 Binary files a/android/assets/800x480/shard.png and b/android/assets/800x480/shard.png differ diff --git a/core/src/zero1hd/polyjet/Polyjet.java b/core/src/zero1hd/polyjet/Polyjet.java index ac65df4..1532aaa 100755 --- a/core/src/zero1hd/polyjet/Polyjet.java +++ b/core/src/zero1hd/polyjet/Polyjet.java @@ -125,6 +125,7 @@ public class Polyjet extends Game { assetManager.load("pop_close.ogg", Sound.class); assetManager.load("laser.png", Texture.class); assetManager.load("pellet.png", Texture.class); + assetManager.load("shard.png", Texture.class); } public void generateFonts() { initComplete = true; diff --git a/core/src/zero1hd/polyjet/entity/Entities.java b/core/src/zero1hd/polyjet/entity/Entities.java index 464bfa8..72e92d7 100755 --- a/core/src/zero1hd/polyjet/entity/Entities.java +++ b/core/src/zero1hd/polyjet/entity/Entities.java @@ -1,7 +1,7 @@ package zero1hd.polyjet.entity; public enum Entities { - POLYJET, BAR_BEAT, VOID_CIRCLE, SHARDS, LASER, PELLET; + POLYJET, BAR_BEAT, VOID_CIRCLE, SHARD, LASER, PELLET; public float x; public float y; diff --git a/core/src/zero1hd/polyjet/entity/EntityController.java b/core/src/zero1hd/polyjet/entity/EntityController.java index f2ceba1..0168e0c 100755 --- a/core/src/zero1hd/polyjet/entity/EntityController.java +++ b/core/src/zero1hd/polyjet/entity/EntityController.java @@ -8,6 +8,7 @@ import com.badlogic.gdx.utils.Pool; import zero1hd.polyjet.entity.ally.Laser; import zero1hd.polyjet.entity.enemies.Pellet; +import zero1hd.polyjet.entity.enemies.Shard; import zero1hd.polyjet.entity.enemies.VoidCircle; public class EntityController { @@ -19,6 +20,7 @@ public class EntityController { //Enemy pool declaration; private Pool voidCirclePool; private Pool pelletPool; + private Pool shardPool; //Ally pool declaration; private Pool laserPool; @@ -43,6 +45,12 @@ public class EntityController { return new Pellet(assets.get("pellet.png", Texture.class)); } }; + shardPool = new Pool() { + @Override + protected Shard newObject() { + return new Shard(assets.get("shard.png", Texture.class)); + } + }; //Ally pool initialization; laserPool = new Pool() { @@ -68,6 +76,10 @@ public class EntityController { Pellet pellet = pelletPool.obtain(); activeEnemies.add(pellet); return pellet; + case SHARD: + Shard shard = shardPool.obtain(); + activeEnemies.add(shard); + return shard; default: return null; } @@ -92,6 +104,13 @@ public class EntityController { pellet.remove(); activeEnemies.removeValue(entity, true); pelletPool.free(pellet); + break; + case SHARD: + Shard shard = (Shard) entity; + shard.remove(); + activeEnemies.removeValue(entity, true); + shardPool.free(shard); + break; default: break; } diff --git a/core/src/zero1hd/polyjet/entity/enemies/Pellet.java b/core/src/zero1hd/polyjet/entity/enemies/Pellet.java index e1206ae..128ba09 100755 --- a/core/src/zero1hd/polyjet/entity/enemies/Pellet.java +++ b/core/src/zero1hd/polyjet/entity/enemies/Pellet.java @@ -41,7 +41,7 @@ public class Pellet extends Actor implements Entity, Poolable { hitBox.setPosition(getX(), getY()); super.act(delta); - if (getX() > Polyjet.GAME_AREA_WIDTH || getY() > Polyjet.GAME_AREA_HEIGHT || getX()-getWidth() < 0 || getY()-getHeight() < 0) { + if (getX() > Polyjet.GAME_AREA_WIDTH || getY() > Polyjet.GAME_AREA_HEIGHT || getX() < 0-getWidth() || getY() < 0-getHeight()) { dead = true; } } diff --git a/core/src/zero1hd/polyjet/entity/enemies/Shard.java b/core/src/zero1hd/polyjet/entity/enemies/Shard.java old mode 100644 new mode 100755 index 5549845..2afacff --- a/core/src/zero1hd/polyjet/entity/enemies/Shard.java +++ b/core/src/zero1hd/polyjet/entity/enemies/Shard.java @@ -1,5 +1,6 @@ package zero1hd.polyjet.entity.enemies; +import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.g2d.Batch; import com.badlogic.gdx.graphics.g2d.Sprite; @@ -7,15 +8,14 @@ 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.Disposable; import com.badlogic.gdx.utils.Pool.Poolable; +import zero1hd.polyjet.Polyjet; import zero1hd.polyjet.entity.Entities; import zero1hd.polyjet.entity.Entity; -public class Shard extends Actor implements Entity, Poolable, Disposable { +public class Shard extends Actor implements Entity, Poolable { private Sprite sprite; - private Texture shard; private Rectangle hitbox; private Vector2 angle; private Vector2 center; @@ -24,10 +24,10 @@ public class Shard extends Actor implements Entity, Poolable, Disposable { private float rate; public Shard(Texture shardTexture) { - this.shard = shardTexture; hitbox = new Rectangle(); angle = new Vector2(); sprite = new Sprite(shardTexture); + sprite.setSize(2f, 3f); center = new Vector2(); } @@ -37,15 +37,13 @@ public class Shard extends Actor implements Entity, Poolable, Disposable { maxHp = hp; setPosition(x, y); this.angle.set(MathUtils.sinDeg(angle), MathUtils.cosDeg(angle)); - sprite.setRotation(angle); - setSize(1f, 1f); + sprite.setRotation(-angle); + setSize(2f, 2f); hitbox.setSize(getWidth(), getHeight()); center.set(getWidth()/2f, getHeight()/2f); sprite.setOrigin(sprite.getWidth()/2f, sprite.getHeight()/2f); } - - @Override public void reset() { hp = 0; @@ -62,43 +60,51 @@ public class Shard extends Actor implements Entity, Poolable, Disposable { @Override public void act(float delta) { moveBy(angle.x*delta*rate, angle.y*rate*delta); - sprite.setPosition(getX()+center.x, getY()+center.y); + hitbox.setPosition(getX(), getY()); + sprite.setCenter(getX()+center.x, getY()+center.y); + + if (getX() > Polyjet.GAME_AREA_WIDTH || getY() > Polyjet.GAME_AREA_HEIGHT || getX() < 0-getWidth() || getY() < 0-getHeight()) { + hp = 0; + } + super.act(delta); } @Override public void draw(Batch batch, float parentAlpha) { + sprite.setColor(1f, 0f, (float)hp/(float)maxHp, 1f); sprite.draw(batch); + batch.setColor(Color.WHITE); super.draw(batch, parentAlpha); } @Override public void collided(Entity entity) { - // TODO Auto-generated method stub + switch (entity.getEntityType()) { + case LASER: + hp--; + break; + default: + break; + } } @Override public Rectangle getHitZone() { - // TODO Auto-generated method stub - return null; + return hitbox; } @Override public Entities getEntityType() { - // TODO Auto-generated method stub - return null; + return Entities.SHARD; } @Override public boolean isDead() { - // TODO Auto-generated method stub + if (hp <= 0) { + return true; + } return false; } - @Override - public void dispose() { - shard.dispose(); - - } - } diff --git a/core/src/zero1hd/polyjet/ui/windows/SpawnerWindow.java b/core/src/zero1hd/polyjet/ui/windows/SpawnerWindow.java index 7ce0025..2889ccd 100755 --- a/core/src/zero1hd/polyjet/ui/windows/SpawnerWindow.java +++ b/core/src/zero1hd/polyjet/ui/windows/SpawnerWindow.java @@ -15,6 +15,7 @@ import zero1hd.polyjet.entity.Entity; import zero1hd.polyjet.entity.EntityController; import zero1hd.polyjet.entity.ally.Laser; import zero1hd.polyjet.entity.enemies.Pellet; +import zero1hd.polyjet.entity.enemies.Shard; import zero1hd.polyjet.entity.enemies.VoidCircle; public class SpawnerWindow extends Window { @@ -79,6 +80,10 @@ public class SpawnerWindow extends Window { voidCircle.init(mod2.getValue(), coords.x, coords.y, mod1.getValue(), mod3.getValue()); stage.addActor(voidCircle); break; + case SHARD: + Shard shard = (Shard) entity; + shard.init(coords.x, coords.y, mod2.getValue()/mod2.getMaxValue()*360f, mod1.getValue(), (int) mod3.getValue()); + stage.addActor(shard); default: break; }