delaytimer gefixt
parent
8f45f0cba3
commit
e0594daa14
BIN
bin/Game.class
BIN
bin/Game.class
Binary file not shown.
|
@ -29,7 +29,7 @@ public class Game {
|
|||
private JLabel fpsLabel;
|
||||
private JLabel liveLabels[];
|
||||
|
||||
private long delaytimer = 4000;
|
||||
private int delaytimer = 4;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private long fps = 60;
|
||||
|
@ -457,24 +457,25 @@ public class Game {
|
|||
fps = 1000000000 / dt; // Berechnen der fps
|
||||
if (frames > 100) {
|
||||
if (fps > 200) {
|
||||
delaytimer += 100;
|
||||
delaytimer++;
|
||||
} else if (fps < 180) {
|
||||
delaytimer -= 100;
|
||||
delaytimer--;
|
||||
}
|
||||
}
|
||||
}
|
||||
delay(delaytimer); // delay ist wichtig, um die geschwindigkeit der objekte und die fps zu
|
||||
// kontrollieren
|
||||
System.out.println(delaytimer);
|
||||
}
|
||||
// ENDE DES MAIN-LOOPS
|
||||
|
||||
}
|
||||
|
||||
// Methode zum verzögern (warten) in ms
|
||||
public void delay(long time) {
|
||||
public void delay(int time) {
|
||||
|
||||
try {
|
||||
Thread.sleep(0, (int) time);
|
||||
Thread.sleep(time);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue