Skip to content

Commit 7f5917b

Browse files
committed
fixed random time flashing in the first frame
1 parent 532be9e commit 7f5917b

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

dist/Ball_game.jar

8 Bytes
Binary file not shown.

src/ball/game/BallGame.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public class BallGame extends Application {
3636
private int mouseX, mouseY;
3737
private static Text scoreText = new Text(10, 25, "Score: 0");
3838
private static int score = 0;
39-
private static Text timeText = new Text(550, 25, "Time wasted: 0");
39+
private static Text timeText = new Text(550, 25, "Time wasted: 0s");
4040
private static long elapsedTime;
4141
private static boolean startTimeSet = false;
4242
private static Text finalTimeText = new Text(680, 50, "12h 48m 14s");
@@ -51,7 +51,7 @@ public void handle(long now) // in ns
5151
if (previous == 0)
5252
previous = now;
5353
float elapsed = (now - previous)/1e9f; // converted to s
54-
if (!pause) {
54+
if (!pause && startTimeSet) {
5555
moveEverything(elapsed);
5656
String currentTime = formatTime((now - elapsedTime)/1000000000);
5757
timeText.setText("Time wasted: " + currentTime);

0 commit comments

Comments
 (0)