diff --git a/android/assets/1280x720/bar.png b/android/assets/1280x720/bar.png new file mode 100755 index 0000000..eff4ab3 Binary files /dev/null and b/android/assets/1280x720/bar.png differ diff --git a/android/assets/1280x800/bar.png b/android/assets/1280x800/bar.png new file mode 100755 index 0000000..195bca6 Binary files /dev/null and b/android/assets/1280x800/bar.png differ diff --git a/android/assets/1366x768/bar.png b/android/assets/1366x768/bar.png new file mode 100755 index 0000000..cf3f610 Binary files /dev/null and b/android/assets/1366x768/bar.png differ diff --git a/android/assets/1920x1080/bar.png b/android/assets/1920x1080/bar.png new file mode 100755 index 0000000..a365736 Binary files /dev/null and b/android/assets/1920x1080/bar.png differ diff --git a/android/assets/1920x1200/bar.png b/android/assets/1920x1200/bar.png new file mode 100755 index 0000000..487342c Binary files /dev/null and b/android/assets/1920x1200/bar.png differ diff --git a/android/assets/2560x1440/bar.png b/android/assets/2560x1440/bar.png new file mode 100755 index 0000000..92dec63 Binary files /dev/null and b/android/assets/2560x1440/bar.png differ diff --git a/android/assets/3840x2160/bar.png b/android/assets/3840x2160/bar.png new file mode 100755 index 0000000..ef6ae74 Binary files /dev/null and b/android/assets/3840x2160/bar.png differ diff --git a/android/assets/800x480/bar.png b/android/assets/800x480/bar.png new file mode 100755 index 0000000..4d25b31 Binary files /dev/null and b/android/assets/800x480/bar.png differ diff --git a/core/src/zero1hd/polyjet/Polyjet.java b/core/src/zero1hd/polyjet/Polyjet.java index 1532aaa..dc7e2fa 100755 --- a/core/src/zero1hd/polyjet/Polyjet.java +++ b/core/src/zero1hd/polyjet/Polyjet.java @@ -126,6 +126,7 @@ public class Polyjet extends Game { assetManager.load("laser.png", Texture.class); assetManager.load("pellet.png", Texture.class); assetManager.load("shard.png", Texture.class); + assetManager.load("bar.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 72e92d7..3185d61 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, SHARD, LASER, PELLET; + POLYJET, BAR, 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 0168e0c..c04c758 100755 --- a/core/src/zero1hd/polyjet/entity/EntityController.java +++ b/core/src/zero1hd/polyjet/entity/EntityController.java @@ -7,6 +7,7 @@ import com.badlogic.gdx.utils.Array; import com.badlogic.gdx.utils.Pool; import zero1hd.polyjet.entity.ally.Laser; +import zero1hd.polyjet.entity.enemies.Bar; import zero1hd.polyjet.entity.enemies.Pellet; import zero1hd.polyjet.entity.enemies.Shard; import zero1hd.polyjet.entity.enemies.VoidCircle; @@ -17,10 +18,12 @@ public class EntityController { public Array activeAllies; public Array activeEnemies; + //Enemy pool declaration; private Pool voidCirclePool; private Pool pelletPool; private Pool shardPool; + private Pool barPool; //Ally pool declaration; private Pool laserPool; @@ -51,6 +54,12 @@ public class EntityController { return new Shard(assets.get("shard.png", Texture.class)); } }; + barPool = new Pool() { + @Override + protected Bar newObject() { + return new Bar(assets.get("bar.png", Texture.class)); + } + }; //Ally pool initialization; laserPool = new Pool() { @@ -80,6 +89,10 @@ public class EntityController { Shard shard = shardPool.obtain(); activeEnemies.add(shard); return shard; + case BAR: + Bar bar = barPool.obtain(); + activeEnemies.add(bar); + return bar; default: return null; } @@ -111,6 +124,11 @@ public class EntityController { activeEnemies.removeValue(entity, true); shardPool.free(shard); break; + case BAR: + Bar bar = (Bar) entity; + bar.remove(); + activeEnemies.removeValue(entity, true); + barPool.free(bar); default: break; } diff --git a/core/src/zero1hd/polyjet/entity/enemies/Bar.java b/core/src/zero1hd/polyjet/entity/enemies/Bar.java new file mode 100755 index 0000000..39ebfae --- /dev/null +++ b/core/src/zero1hd/polyjet/entity/enemies/Bar.java @@ -0,0 +1,82 @@ +package zero1hd.polyjet.entity.enemies; + +import com.badlogic.gdx.graphics.Texture; +import com.badlogic.gdx.graphics.g2d.Batch; +import com.badlogic.gdx.math.Rectangle; +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; + +public class Bar extends Actor implements Entity, Poolable { + private boolean dead; + private Texture texture; + private float rate; + private Rectangle hitbox; + + public Bar(Texture barTexture) { + this.texture = barTexture; + hitbox = new Rectangle(); + } + + public void init(float x, float rate) { + setSize(5f, 0.5f); + setPosition(x, Polyjet.GAME_AREA_HEIGHT); + this.rate = rate; + hitbox.set(getX(), getY(), getWidth(), getHeight()); + } + + @Override + public void act(float delta) { + moveBy(0f, -delta*rate); + hitbox.setPosition(getX(), getY()); + super.act(delta); + if (getY() < 0-getHeight()) { + dead = true; + } + } + + @Override + public void draw(Batch batch, float parentAlpha) { + batch.draw(texture, getX(), getY(), getWidth(), getHeight()); + super.draw(batch, parentAlpha); + } + + @Override + public void reset() { + hitbox.set(0, 0, 0, 0); + setPosition(0, 0); + rate = 0; + dead = false; + setSize(0, 0); + } + + @Override + public void collided(Entity entity) { + switch (entity.getEntityType()) { + case POLYJET: + dead = true; + break; + default: + break; + } + } + + @Override + public Rectangle getHitZone() { + return hitbox; + } + + @Override + public Entities getEntityType() { + return Entities.BAR; + } + + @Override + public boolean isDead() { + return dead; + } + +} diff --git a/core/src/zero1hd/polyjet/entity/enemies/Shard.java b/core/src/zero1hd/polyjet/entity/enemies/Shard.java index 2afacff..f7e7a2a 100755 --- a/core/src/zero1hd/polyjet/entity/enemies/Shard.java +++ b/core/src/zero1hd/polyjet/entity/enemies/Shard.java @@ -35,12 +35,12 @@ public class Shard extends Actor implements Entity, Poolable { this.rate = rate; this.hp = hp; maxHp = hp; - setPosition(x, y); this.angle.set(MathUtils.sinDeg(angle), MathUtils.cosDeg(angle)); sprite.setRotation(-angle); setSize(2f, 2f); hitbox.setSize(getWidth(), getHeight()); center.set(getWidth()/2f, getHeight()/2f); + setPosition(x-center.x, y-center.y); sprite.setOrigin(sprite.getWidth()/2f, sprite.getHeight()/2f); } diff --git a/core/src/zero1hd/polyjet/ui/stages/GamePlayArea.java b/core/src/zero1hd/polyjet/ui/stages/GamePlayArea.java index 2dc659f..4a5eb0e 100755 --- a/core/src/zero1hd/polyjet/ui/stages/GamePlayArea.java +++ b/core/src/zero1hd/polyjet/ui/stages/GamePlayArea.java @@ -120,7 +120,7 @@ public class GamePlayArea extends Stage { if (keycode == KeyMap.shoot) { Laser laser = (Laser) entityController.retrieveEntity(Entities.LASER); - laser.init(polyjet.getX() + (polyjet.getWidth()-laser.getWidth())/2f, polyjet.getY() + polyjet.getHeight()+0.25f, 30f); + laser.init(polyjet.getX() + (polyjet.getWidth()-laser.getWidth())/2f, polyjet.getY() + polyjet.getHeight()+0.25f, 60f); addActor(laser); } return false; diff --git a/core/src/zero1hd/polyjet/ui/windows/SpawnerWindow.java b/core/src/zero1hd/polyjet/ui/windows/SpawnerWindow.java index 2889ccd..e035a31 100755 --- a/core/src/zero1hd/polyjet/ui/windows/SpawnerWindow.java +++ b/core/src/zero1hd/polyjet/ui/windows/SpawnerWindow.java @@ -14,6 +14,7 @@ import zero1hd.polyjet.entity.Entities; import zero1hd.polyjet.entity.Entity; import zero1hd.polyjet.entity.EntityController; import zero1hd.polyjet.entity.ally.Laser; +import zero1hd.polyjet.entity.enemies.Bar; import zero1hd.polyjet.entity.enemies.Pellet; import zero1hd.polyjet.entity.enemies.Shard; import zero1hd.polyjet.entity.enemies.VoidCircle; @@ -63,8 +64,6 @@ public class SpawnerWindow extends Window { Entity entity; if ((entity = ec.retrieveEntity(listOfEntities.getSelected())) != null) { switch(entity.getEntityType()) { - case BAR_BEAT: - break; case LASER: Laser laser = (Laser) entity; laser.init(coords.x, coords.y, mod1.getValue()); @@ -84,6 +83,12 @@ public class SpawnerWindow extends Window { Shard shard = (Shard) entity; shard.init(coords.x, coords.y, mod2.getValue()/mod2.getMaxValue()*360f, mod1.getValue(), (int) mod3.getValue()); stage.addActor(shard); + break; + case BAR: + Bar bar = (Bar) entity; + bar.init(coords.x, mod1.getValue()); + stage.addActor(bar); + break; default: break; }