Jonathan Hager 5 years ago
commit 969ac08beb

Binary file not shown.

Binary file not shown.

@ -33,7 +33,7 @@ public class Controller extends ApplicationAdapter implements InputProcessor {
final int WALL_LIFETIME = 75;
int difficulty = 0;
int difficulty = 1;
SpriteBatch batch;
ShapeRenderer renderer;
@ -62,6 +62,9 @@ public class Controller extends ApplicationAdapter implements InputProcessor {
screen.timer();
if(screen.getId() == 1) {
model.timerStep();
if(model.isToReset()){
screen = new EndScreen(GAME_WORLD_WIDTH,GAME_WORLD_HEIGHT,model.getEnding());
}
}
}
}, 0, 0.05f);
@ -131,7 +134,9 @@ public class Controller extends ApplicationAdapter implements InputProcessor {
// write left Length
batch.begin();
font.setColor(Color.BLACK);
font.draw(batch, ""+model.getLeftWallLength(), 1500f,800f);
font.getData().setScale(2);
font.draw(batch, "Wall pieces: "+model.getLeftWallLength(), 1170f,875f);
font.getData().setScale(1);
batch.end();
// DRAW MONSTER
model.getMonster().drawMonster(renderer,polygonSpriteBatch);
@ -201,13 +206,15 @@ public class Controller extends ApplicationAdapter implements InputProcessor {
switch(keycode){
case 0: //GOTO MAINMENU
screen = new MainMenuScreen(GAME_WORLD_WIDTH,GAME_WORLD_HEIGHT);
difficulty = 1;
break;
case 1: //NEW GAMESCREEN
model = new Model(difficulty);
screen = new GameScreen(GAME_WORLD_WIDTH,GAME_WORLD_HEIGHT);
break;
case 2: //GOTO ENDSCREEN
screen = new EndScreen(GAME_WORLD_WIDTH,GAME_WORLD_HEIGHT);
screen = new EndScreen(GAME_WORLD_WIDTH,GAME_WORLD_HEIGHT, true);
difficulty = 1;
break;
case 3:
difficulty = 1;

@ -19,6 +19,9 @@ public class Model {
private boolean drawing = false;
private int currentLength;
private boolean toReset;
private boolean ending;
private int difficulty;
private int leftWallLength = 5000;
@ -47,10 +50,10 @@ public class Model {
walls.remove(i);
i--;
}
if (monster.getIsDead()) {
// TODO: Tod implementieren
}
}
if (monster.getIsDead()) {
toReset = true;
ending = true; // Monster win - Player lost
}
// Generation of new projectiles
@ -160,4 +163,12 @@ public class Model {
public int getCurrentLength() {
return currentLength;
}
public boolean isToReset() {
return toReset;
}
public boolean getEnding() {
return ending;
}
}

@ -102,7 +102,7 @@ public class Monster {
private void hit(){
hp--;
if(hp == 0){
if(hp <= 0){
die();
}
}

@ -12,13 +12,22 @@ import com.trs.game.view.Text;
public class EndScreen extends Screen {
public EndScreen(int GAME_WORLD_WIDTH, int GAME_WORLD_HEIGHT){
boolean lost;
public EndScreen(int GAME_WORLD_WIDTH, int GAME_WORLD_HEIGHT, boolean lost){
super(GAME_WORLD_WIDTH, GAME_WORLD_HEIGHT, 2);
this.lost = lost;
if(lost)
texts.add(new Text(GAME_WORLD_WIDTH/2, (int)((float)GAME_WORLD_HEIGHT * 0.85f), "The monster ate too many doods!", Color.BLACK, 3, 0,0));
else
texts.add(new Text(GAME_WORLD_WIDTH/2, (int)((float)GAME_WORLD_HEIGHT * 0.85f), "You successfully starved the Monster!", Color.BLACK, 3, 0,0));
texts.add(new Text(GAME_WORLD_WIDTH/2, GAME_WORLD_HEIGHT/2, "click to restart...", Color.BLACK, 2, GAME_WORLD_HEIGHT/2 - 30,GAME_WORLD_HEIGHT/2 + 30));
buttons.add(new Button(-1,250,100,240,50,"Difficulty",Color.BLACK,Color.WHITE));
buttons.add(new Button(3,500,100,210,50,"Easy",Color.DARK_GRAY,Color.WHITE));
buttons.add(new Button(4,710,100,210,50,"Medium",Color.GRAY,Color.WHITE));
buttons.add(new Button(4,710,100,210,50,"Medium",Color.GRAY,Color.BLUE));
buttons.add(new Button(5,920,100,210,50,"Hard",Color.DARK_GRAY,Color.WHITE));
buttons.add(new Button(6,1130,100,210,50,"Impossible",Color.GRAY,Color.WHITE));
}

@ -14,11 +14,6 @@ public class GameScreen extends Screen {
public GameScreen(int GAME_WORLD_WIDTH, int GAME_WORLD_HEIGHT){
super(GAME_WORLD_WIDTH, GAME_WORLD_HEIGHT, 1);
//buttons.add(new Button(-1,0,0,200,80,"GameScreen", Color.BLACK,Color.WHITE));
buttons.add(new Button(0,0,800,200,100, "MainMenu", Color.BLACK,Color.WHITE));
buttons.add(new Button(1,200,800,200,100, "GameScreen", Color.DARK_GRAY,Color.WHITE));
buttons.add(new Button(2,400,800,200,100, "EndScreen", Color.BLACK,Color.WHITE));
}
@Override

@ -20,7 +20,7 @@ public class MainMenuScreen extends Screen {
buttons.add(new Button(-1,250,100,240,50,"Difficulty",Color.BLACK,Color.WHITE));
buttons.add(new Button(3,500,100,210,50,"Easy",Color.DARK_GRAY,Color.WHITE));
buttons.add(new Button(4,710,100,210,50,"Medium",Color.GRAY,Color.WHITE));
buttons.add(new Button(4,710,100,210,50,"Medium",Color.GRAY,Color.BLUE));
buttons.add(new Button(5,920,100,210,50,"Hard",Color.DARK_GRAY,Color.WHITE));
buttons.add(new Button(6,1130,100,210,50,"Impossible",Color.GRAY,Color.WHITE));
}

Loading…
Cancel
Save