began work on collision detection and added first enemy
This commit is contained in:
@@ -7,6 +7,7 @@ import com.badlogic.gdx.InputProcessor;
|
||||
import com.badlogic.gdx.ScreenAdapter;
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.graphics.GL20;
|
||||
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
|
||||
import com.badlogic.gdx.scenes.scene2d.Actor;
|
||||
import com.badlogic.gdx.scenes.scene2d.Stage;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Image;
|
||||
@@ -37,6 +38,8 @@ public class GameScreen extends ScreenAdapter implements InputProcessor {
|
||||
|
||||
private AudioData music;
|
||||
|
||||
private ShapeRenderer shapeRenderer;
|
||||
|
||||
public GameScreen(Polyjet polyJet) {
|
||||
core = polyJet;
|
||||
|
||||
@@ -87,7 +90,7 @@ public class GameScreen extends ScreenAdapter implements InputProcessor {
|
||||
|
||||
@Override
|
||||
public void changed(ChangeEvent event, Actor actor) {
|
||||
recommence();
|
||||
restart();
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -120,13 +123,16 @@ public class GameScreen extends ScreenAdapter implements InputProcessor {
|
||||
Gdx.gl.glClearColor(1f, 1f, 1f, 1f);
|
||||
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT);
|
||||
gameArea.getViewport().apply();
|
||||
|
||||
shapeRenderer.begin();
|
||||
gameArea.draw();
|
||||
|
||||
shapeRenderer.end();
|
||||
|
||||
|
||||
overlay.getViewport().apply();
|
||||
overlay.draw();
|
||||
if (!paused) {
|
||||
music.readIndexUpdate();
|
||||
gameArea.setAudioIndex(music.getReadIndex());
|
||||
scoreLabel.setText("Score: " + gameArea.getScore());
|
||||
gameArea.act(delta);
|
||||
|
||||
@@ -135,12 +141,13 @@ public class GameScreen extends ScreenAdapter implements InputProcessor {
|
||||
}
|
||||
|
||||
overlay.act(delta);
|
||||
} else {
|
||||
}
|
||||
|
||||
if (!music.getPlaybackMusic().isPlaying()) {
|
||||
end(true);
|
||||
}
|
||||
|
||||
super.render(delta);
|
||||
}
|
||||
|
||||
private void end(boolean trueEnd) {
|
||||
@@ -179,7 +186,7 @@ public class GameScreen extends ScreenAdapter implements InputProcessor {
|
||||
super.resume();
|
||||
}
|
||||
|
||||
public void recommence() {
|
||||
public void restart() {
|
||||
paused = false;
|
||||
pauseMenu.remove();
|
||||
music.getPlaybackMusic().play();
|
||||
@@ -207,7 +214,7 @@ public class GameScreen extends ScreenAdapter implements InputProcessor {
|
||||
|
||||
case Keys.ESCAPE:
|
||||
if (paused) {
|
||||
recommence();
|
||||
restart();
|
||||
} else {
|
||||
pause();
|
||||
}
|
||||
|
Reference in New Issue
Block a user