new entity management and hit detection concepts, began implementing in game play area

This commit is contained in:
2017-05-30 16:23:08 -05:00
parent 562dbb8117
commit 4894d6eea8
9 changed files with 174 additions and 115 deletions

View File

@@ -42,7 +42,8 @@ public class GameScreen extends ScreenAdapter implements InputProcessor {
public GameScreen(Polyjet polyJet) {
core = polyJet;
shapeRenderer = new ShapeRenderer();
// Overlay stuff
overlay = new Stage();
scoreLabel = new Label("Score: 0", core.getDefaultSkin(), "default-font", Color.WHITE);
@@ -70,7 +71,7 @@ public class GameScreen extends ScreenAdapter implements InputProcessor {
@Override
public void act(float delta) {
setHeight(
((float) gameArea.getHealth() / (float) gameArea.getMaxHealth()) * (healthBarTank.getHeight()));
((float) gameArea.getPolyjet().health / (float) gameArea.getMaxHealth()) * (healthBarTank.getHeight()));
super.act(delta);
}
};
@@ -90,7 +91,7 @@ public class GameScreen extends ScreenAdapter implements InputProcessor {
@Override
public void changed(ChangeEvent event, Actor actor) {
restart();
reBegin();
}
});
}
@@ -100,7 +101,7 @@ public class GameScreen extends ScreenAdapter implements InputProcessor {
(Gdx.graphics.getHeight() - pauseMenu.getHeight()) / 2);
// Continue to add things to input multiplexer
gameArea = new GamePlayArea(core);
gameArea = new GamePlayArea(polyJet.getAssetManager(), shapeRenderer);
inputs = new InputMultiplexer();
inputs.addProcessor(this);
@@ -136,7 +137,7 @@ public class GameScreen extends ScreenAdapter implements InputProcessor {
scoreLabel.setText("Score: " + gameArea.getScore());
gameArea.act(delta);
if (gameArea.getHealth() == 0) {
if (gameArea.getPolyjet().isDead()) {
end(false);
}
@@ -186,7 +187,7 @@ public class GameScreen extends ScreenAdapter implements InputProcessor {
super.resume();
}
public void restart() {
public void reBegin() {
paused = false;
pauseMenu.remove();
music.getPlaybackMusic().play();
@@ -214,7 +215,7 @@ public class GameScreen extends ScreenAdapter implements InputProcessor {
case Keys.ESCAPE:
if (paused) {
restart();
reBegin();
} else {
pause();
}