Commit fe13df93 authored by Bastian's avatar Bastian
Browse files

Added GameOver Logic

parent e489941d
......@@ -8,7 +8,6 @@ import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.Batch;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.GlyphLayout;
import com.badlogic.gdx.graphics.g2d.Sprite;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
import com.badlogic.gdx.math.Rectangle;
......@@ -217,9 +216,11 @@ public class GameScreen implements Screen {
removes.addAll(map.getNeighborsOf(h));
if (p1.placedBubbleThisRound) {
p1.score += sum;
p1.placedBubbleThisRound = false;
}
if (p2.placedBubbleThisRound) {
p2.score += sum;
p2.placedBubbleThisRound = false;
}
}
}
......@@ -246,6 +247,19 @@ public class GameScreen implements Screen {
iterator.remove();
}
}
for(Hexagon h : nachbarn.keySet())
{
if(nachbarn.get(h)!=null)
{
double y = h.getCenterY();
if(y > wHeight-2*bubblradius || y < 4*bubblradius)
{
FrozenNumbersGame.m_Screens.put("GameOverScreen", new GameOverScreen(p1.score, p2.score));
FrozenNumbersGame.game.setScreen(FrozenNumbersGame.m_Screens.get("GameOverScreen"));
}
}
}
FrozenNumbersGame.viewport.apply(true);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment