Skip to content
Snippets Groups Projects
Commit 19905d69 authored by Marcus Christopher Wildish's avatar Marcus Christopher Wildish
Browse files

Merge branch '2-create-game-model-brach-timerFix' into '2-create-game-model'

Goes to waitinglobbyView if timer is finished. Time is displayed as int instead of float.

See merge request !20
parents 06f18d93 37ab3718
No related branches found
No related tags found
2 merge requests!22Resolve "Create game model",!20Goes to waitinglobbyView if timer is finished. Time is displayed as int instead of float.
......@@ -197,9 +197,15 @@ public class GamePlayController {
public void update(float dt) {
gamePlayView.update(dt);
handleInput();
//Check if gameTimer is up. If so allert database, award player 0 points and go to waitingLobby.
if (!gamePlayView.isTimerRunning()){
_FBIC.updateFinishedFlag(nickname, pin);
state.getStateManager().setState(new WaitingLobbyState(state.getStateManager(), _FBIC, nickname, 0, pin));
}
}
public int calculateScore(float timeLeft, float maxTime) {
// Parameters to shape the S-curve
float steepness = 10.0f; // Change this to make the curve steeper or shallower
......
......@@ -92,6 +92,7 @@ public class GamePlayView {
timeLeft = 0;
isTimerRunning = false; // Stop the timer when it reaches 0
// Handle time out logic
}
}
}
......@@ -144,8 +145,9 @@ public class GamePlayView {
letterBounds[i] = new Rectangle(x, y-120, 120, 120);
}
// Draw time
font.draw(sb, "Time: " + String.format("%.1f", timeLeft), cam.viewportWidth / 2 - 200, cam.viewportHeight - 200);
font.draw(sb, "Time: " + String.format("%o", Math.round(timeLeft)), cam.viewportWidth / 2 - 200, cam.viewportHeight - 200);
sb.end(); // End SpriteBatch
......@@ -244,6 +246,10 @@ public class GamePlayView {
isTimerRunning = false;
}
public boolean isTimerRunning() {
return isTimerRunning;
}
public void resetTimer(float newTime) {
timeLeft = newTime;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment