GammelJan 6 years ago
parent 93b38a2dd5
commit 112ac30236

@ -46,6 +46,8 @@ public class Controller extends ApplicationAdapter implements InputProcessor{
boolean isColliding;
Level[] level;
int currentLevel;
int beatenLevel;
OrthographicCamera camera;
Viewport viewport;
@ -154,6 +156,7 @@ public class Controller extends ApplicationAdapter implements InputProcessor{
gs.dispose();
stepTimer.stop();
level[currentLevel].reset();
beatenLevel++;
gs = null;
ws = new Winscreen(GAME_WORLD_WIDTH, GAME_WORLD_HEIGHT, true, currentLevel);
}
@ -188,14 +191,14 @@ public class Controller extends ApplicationAdapter implements InputProcessor{
if(ts != null){
ts.dispose();
ts = null;
ls = new Levelscreen(levelAmount, GAME_WORLD_WIDTH, GAME_WORLD_HEIGHT);
ls = new Levelscreen(beatenLevel, GAME_WORLD_WIDTH, GAME_WORLD_HEIGHT);
}
else if(ls != null){
if(x < Gdx.graphics.getWidth() * 0.15){
if(ls.getSelectedLevel() > 0)ls.setSelectedLevel(ls.getSelectedLevel()-1);
}
else if(x > Gdx.graphics.getWidth() * 0.85){
if(ls.getSelectedLevel() < levelAmount)
if(ls.getSelectedLevel() < beatenLevel)
ls.setSelectedLevel(ls.getSelectedLevel()+1);
}
else{
@ -212,7 +215,7 @@ public class Controller extends ApplicationAdapter implements InputProcessor{
}
else if(ws != null){
if(x < Gdx.graphics.getWidth() * 0.33){
ls = new Levelscreen(levelAmount, GAME_WORLD_WIDTH, GAME_WORLD_HEIGHT);
ls = new Levelscreen(beatenLevel, GAME_WORLD_WIDTH, GAME_WORLD_HEIGHT);
ws = null;
}
else if(x < Gdx.graphics.getWidth() * 0.66){
@ -220,7 +223,7 @@ public class Controller extends ApplicationAdapter implements InputProcessor{
stepTimer.start();
ws = null;
}
else if(currentLevel < levelAmount){
else if(currentLevel < levelAmount && ws.getWin()){
currentLevel++;
gs = new Gamescreen(level[currentLevel], GAME_WORLD_WIDTH, GAME_WORLD_HEIGHT, camera.combined);
stepTimer.start();

@ -80,7 +80,7 @@ public class Winscreen{
}
public void render(SpriteBatch batch) {
if(lvl < 9)next.draw(batch);
if(lvl < 9 && win)next.draw(batch);
level.draw(batch);
reset.draw(batch);
if(win)winSprite.draw(batch);
@ -89,4 +89,7 @@ public class Winscreen{
public void dispose() {
t.clear();
}
public boolean getWin(){
return win;
}
}

Loading…
Cancel
Save