master
Jan Ehehalt 6 years ago
parent 42a7bf5343
commit 4171b19cb2

@ -59,7 +59,7 @@ public class Controller extends ApplicationAdapter implements InputProcessor{
ls = null; ls = null;
gs = null; gs = null;
ws = null; ws = null;
levelAmount = 10; levelAmount = 9;
currentLevel = -1; currentLevel = -1;
batch = new SpriteBatch(); batch = new SpriteBatch();
Gdx.input.setInputProcessor(this); Gdx.input.setInputProcessor(this);
@ -96,7 +96,7 @@ public class Controller extends ApplicationAdapter implements InputProcessor{
gs.dispose(); gs.dispose();
stepTimer.stop(); stepTimer.stop();
gs = null; gs = null;
ws = new Winscreen(GAME_WORLD_WIDTH, GAME_WORLD_HEIGHT, false); ws = new Winscreen(GAME_WORLD_WIDTH, GAME_WORLD_HEIGHT, false, currentLevel);
} }
else{ else{
level[currentLevel].step(); level[currentLevel].step();
@ -153,8 +153,9 @@ public class Controller extends ApplicationAdapter implements InputProcessor{
if(gs.getWin()){ if(gs.getWin()){
gs.dispose(); gs.dispose();
stepTimer.stop(); stepTimer.stop();
level[currentLevel].reset();
gs = null; gs = null;
ws = new Winscreen(GAME_WORLD_WIDTH, GAME_WORLD_HEIGHT, true); ws = new Winscreen(GAME_WORLD_WIDTH, GAME_WORLD_HEIGHT, true, currentLevel);
} }
} }
else if(ws != null) ws.render(batch); else if(ws != null) ws.render(batch);
@ -212,17 +213,20 @@ public class Controller extends ApplicationAdapter implements InputProcessor{
else if(ws != null){ else if(ws != null){
if(x < Gdx.graphics.getWidth() * 0.33){ if(x < Gdx.graphics.getWidth() * 0.33){
ls = new Levelscreen(levelAmount, GAME_WORLD_WIDTH, GAME_WORLD_HEIGHT); ls = new Levelscreen(levelAmount, GAME_WORLD_WIDTH, GAME_WORLD_HEIGHT);
ws = null;
} }
else if(x < Gdx.graphics.getWidth() * 0.66){ else if(x < Gdx.graphics.getWidth() * 0.66){
gs = new Gamescreen(level[currentLevel], GAME_WORLD_WIDTH, GAME_WORLD_HEIGHT, camera.combined); gs = new Gamescreen(level[currentLevel], GAME_WORLD_WIDTH, GAME_WORLD_HEIGHT, camera.combined);
stepTimer.start(); stepTimer.start();
ws = null;
} }
else{ else if(currentLevel < levelAmount){
currentLevel++; currentLevel++;
gs = new Gamescreen(level[currentLevel], GAME_WORLD_WIDTH, GAME_WORLD_HEIGHT, camera.combined); gs = new Gamescreen(level[currentLevel], GAME_WORLD_WIDTH, GAME_WORLD_HEIGHT, camera.combined);
stepTimer.start(); stepTimer.start();
ws = null;
} }
ws = null;
} }
return true; return true;
} }

@ -116,7 +116,7 @@ public class Gamescreen{
shapeRenderer.circle((float) p.getxPos(), (float) p.getyPos(), p.getRadius()); shapeRenderer.circle((float) p.getxPos(), (float) p.getyPos(), p.getRadius());
shapeRenderer.setColor(Color.RED); shapeRenderer.setColor(Color.RED);
/*
//goal hitboxes //goal hitboxes
for(int i = 0; i < goalRects.length; i++){ for(int i = 0; i < goalRects.length; i++){
shapeRenderer.rect(goalRects[i].getX(), goalRects[i].getY(), goalRects[i].getWidth(), goalRects[i].getHeight()); shapeRenderer.rect(goalRects[i].getX(), goalRects[i].getY(), goalRects[i].getWidth(), goalRects[i].getHeight());

@ -32,12 +32,15 @@ public class Winscreen{
float GAME_WORLD_HEIGHT; float GAME_WORLD_HEIGHT;
boolean win; boolean win;
int lvl;
public Winscreen(float width, float height, boolean win){ public Winscreen(float width, float height, boolean win, int lvl){
t = new Timer(); t = new Timer();
GAME_WORLD_WIDTH = width; GAME_WORLD_WIDTH = width;
GAME_WORLD_HEIGHT = height; GAME_WORLD_HEIGHT = height;
this.win = win; this.win = win;
this.lvl = lvl;
if(win){ if(win){
movement = true; movement = true;
@ -77,7 +80,7 @@ public class Winscreen{
} }
public void render(SpriteBatch batch) { public void render(SpriteBatch batch) {
next.draw(batch); if(lvl < 9)next.draw(batch);
level.draw(batch); level.draw(batch);
reset.draw(batch); reset.draw(batch);
if(win)winSprite.draw(batch); if(win)winSprite.draw(batch);

Loading…
Cancel
Save