Add a thread sleep to keep the game running at speed

Co-authored-by: r3cp3ct <45179536+r3cp3ct@users.noreply.github.com>
Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
This commit is contained in:
sigonasr2 2022-06-09 23:52:09 -05:00
parent 6ffcf0be3b
commit d5bb96b29a
3 changed files with 7 additions and 2 deletions

Binary file not shown.

Binary file not shown.

View File

@ -26,7 +26,7 @@ import java.awt.event.KeyEvent;
public class RabiClone {
public static final String PROGRAM_NAME = "RabiClone";
public static final String BLANK = "\0";
public static String BLANK = "\0";
public static int UPCOUNT = 0;
public static Panel p;
@ -142,7 +142,12 @@ public class RabiClone {
lastReportedTime = System.currentTimeMillis();
}
}
System.out.print(BLANK); //This is hackish. Removing this slows down the game by about 30%. The timer runs slower. ???
try {
Thread.sleep(4);
} catch (InterruptedException e) {
e.printStackTrace();
}
//System.out.print(BLANK); //This is hackish. Removing this slows down the game by about 30%. The timer runs slower. ???
}
}