diff --git a/core/src/zero1hd/polyjet/controls/KeyMap.java b/core/src/zero1hd/polyjet/controls/KeyMap.java index 44ad6e0..4cdfa86 100755 --- a/core/src/zero1hd/polyjet/controls/KeyMap.java +++ b/core/src/zero1hd/polyjet/controls/KeyMap.java @@ -23,6 +23,8 @@ public class KeyMap { public static final String SECONDTHIRDTELEPORT = "secondThirdTP"; public static final String THIRDTHIRDTELEPORT = "thirdThirdTP"; + public static final String ACCELERATE = "accelerate"; + /** * forward binding. */ @@ -56,6 +58,8 @@ public class KeyMap { */ public static int thirdThirdTeleport; + public static int accelerate; + public KeyMap(Polyjet core) { keyTextures = core.getAssetManager().get("keyboard.atlas", TextureAtlas.class); @@ -108,6 +112,8 @@ public class KeyMap { firstThirdTeleport = keyBindPrefs.getInteger(KeyMap.FIRSTTHIRDTELEPORT, Keys.Q); secondThirdTeleport = keyBindPrefs.getInteger(KeyMap.SECONDTHIRDTELEPORT, Keys.W); thirdThirdTeleport = keyBindPrefs.getInteger(KeyMap.THIRDTHIRDTELEPORT, Keys.E); + + accelerate = keyBindPrefs.getInteger(KeyMap.ACCELERATE, Keys.SHIFT_LEFT); } /** @@ -135,6 +141,8 @@ public class KeyMap { return KeyMap.secondThirdTeleport; } else if (control == KeyMap.THIRDTHIRDTELEPORT) { return KeyMap.thirdThirdTeleport; + } else if (control == KeyMap.ACCELERATE) { + return KeyMap.accelerate; } else { return -1; } diff --git a/core/src/zero1hd/polyjet/entity/ally/PolyJetEntity.java b/core/src/zero1hd/polyjet/entity/ally/PolyJetEntity.java index 9929f82..b49daa1 100755 --- a/core/src/zero1hd/polyjet/entity/ally/PolyJetEntity.java +++ b/core/src/zero1hd/polyjet/entity/ally/PolyJetEntity.java @@ -6,6 +6,7 @@ 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; @@ -20,10 +21,12 @@ public class PolyJetEntity extends Actor implements Entity { private ParticleEffect teleportCloak; private Rectangle hitbox; - public boolean moveLeft, moveRight, moveUp, moveDown, teleporting; + public boolean moveLeft, moveRight, moveUp, moveDown, teleporting, accelerate; + private float speed, accel; private float rate; - public PolyJetEntity(AssetManager assets, float rate, String jet) { - this.rate = rate; + public PolyJetEntity(AssetManager assets, float speed, float accel, String jet) { + this.speed = speed; + this.accel = accel; setSize(1.5f, 1.5f); setPosition(Polyjet.GAME_AREA_WIDTH/2 - getWidth()/2, -4f); @@ -47,6 +50,12 @@ public class PolyJetEntity extends Actor implements Entity { //Movement! + if (accelerate) { + rate = speed + accel; + } else { + rate = speed; + } + if (moveLeft && !moveRight) { moveBy(-(rate*delta), 0); } @@ -60,7 +69,7 @@ public class PolyJetEntity extends Actor implements Entity { if (moveDown && !moveUp) { moveBy(0, -rate*delta); } - + super.act(delta); } diff --git a/core/src/zero1hd/polyjet/entity/enemies/Pellet.java b/core/src/zero1hd/polyjet/entity/enemies/Pellet.java index 81e093b..e1206ae 100755 --- a/core/src/zero1hd/polyjet/entity/enemies/Pellet.java +++ b/core/src/zero1hd/polyjet/entity/enemies/Pellet.java @@ -56,8 +56,10 @@ public class Pellet extends Actor implements Entity, Poolable { @Override public void collided(Entity entity) { - if (entity.getEntityType() == Entities.LASER) { + switch (entity.getEntityType()) { + default: dead = true; + break; } } diff --git a/core/src/zero1hd/polyjet/ui/stages/GamePlayArea.java b/core/src/zero1hd/polyjet/ui/stages/GamePlayArea.java index c172a58..2dc659f 100755 --- a/core/src/zero1hd/polyjet/ui/stages/GamePlayArea.java +++ b/core/src/zero1hd/polyjet/ui/stages/GamePlayArea.java @@ -31,7 +31,7 @@ public class GamePlayArea extends Stage { public GamePlayArea(AssetManager assetManager) { super(new FitViewport(Polyjet.GAME_AREA_WIDTH, Polyjet.GAME_AREA_HEIGHT)); - polyjet = new PolyJetEntity(assetManager, 48f, "standard"); + polyjet = new PolyJetEntity(assetManager, 25f, 25f, "standard"); shapes = new ShapeRenderer(); shapes.setProjectionMatrix(getCamera().combined); @@ -92,6 +92,10 @@ public class GamePlayArea extends Stage { if (keycode == KeyMap.down) { polyjet.moveDown = true; } + + if (keycode == KeyMap.accelerate) { + polyjet.accelerate = true; + } return false; } @@ -109,6 +113,11 @@ public class GamePlayArea extends Stage { if (keycode == KeyMap.down) { polyjet.moveDown = false; } + + if (keycode == KeyMap.accelerate) { + polyjet.accelerate = false; + } + 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);