diff --git a/app/src/main/java/jonathan/balljumper/GameSurfaceView.java b/app/src/main/java/jonathan/balljumper/GameSurfaceView.java index 71e4231..5a417d8 100644 --- a/app/src/main/java/jonathan/balljumper/GameSurfaceView.java +++ b/app/src/main/java/jonathan/balljumper/GameSurfaceView.java @@ -105,7 +105,7 @@ // If the ball goes below the screen, you lose. if (ball.getBottom() >= screenSize.y) { - pause(); + lose(); } ball.move(); @@ -207,4 +207,17 @@ return true; } + + public void lose() { + isRunning = false; + + try { + gameThread.sleep(1000); + } catch (InterruptedException e) { } + + ball.bounce(); + ball.setX(screenSize.x / 2 - ball.getWidth() / 2); + ball.setY((screenSize.y / 3) * 2 - ball.getWidth() / 2); + isRunning = true; + } }