Kleine Gameloop-Änderung.

Getter für player Objekt hinzugefügt!
This commit is contained in:
toksikk
2014-11-14 10:43:12 +01:00
parent cd05149ede
commit bb2f63277e
+24 -21
View File
@@ -179,6 +179,10 @@ public class GameLoopD extends JFrame implements Runnable {
} }
} }
public static Player getPlayer() {
return player01;
}
public synchronized void start() { public synchronized void start() {
if (running) { if (running) {
return; return;
@@ -221,9 +225,7 @@ public class GameLoopD extends JFrame implements Runnable {
delta += (now-lastTime) / ns; delta += (now-lastTime) / ns;
lastTime = now; lastTime = now;
if (delta >= 1) { if (delta >= 1) {
if (!pause) { tick();
tick();
}
updates++; updates++;
delta--; delta--;
} }
@@ -232,7 +234,6 @@ public class GameLoopD extends JFrame implements Runnable {
try { try {
thread.sleep(1); // entlastet die cpu massiv. thread.sleep(1); // entlastet die cpu massiv.
} catch (InterruptedException e) { } catch (InterruptedException e) {
// TODO Auto-generated catch block // TODO Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
@@ -256,26 +257,28 @@ public class GameLoopD extends JFrame implements Runnable {
Config.currentTickNr++; Config.currentTickNr++;
} }
kb.checkKeyActivity(); kb.checkKeyActivity();
ActionWatcher.tick(); if (!pause) {
ActionControl.actionControl(); ActionWatcher.tick();
HardwareResetTimers.tick(); ActionControl.actionControl();
player01.tick(); HardwareResetTimers.tick();
opponent01.tick(); player01.tick();
opponent02.tick(); opponent01.tick();
opponent03.tick(); opponent02.tick();
opponent04.tick(); opponent03.tick();
opponent05.tick(); opponent04.tick();
opponent06.tick(); opponent05.tick();
CollisionHandler.tick(); opponent06.tick();
CollisionHandler.tick();
}
} }
// alles was animiert wird hier rein (paints) // alles was animiert wird hier rein (paints)
private void render() { private void render() {
player01.repaint(); // player01.repaint();
outerPanel.repaint(); // outerPanel.repaint();
gamePanel.repaint(); // gamePanel.repaint();
actionPanel.repaint(); // actionPanel.repaint();
statusPanel.repaint(); // statusPanel.repaint();
this.repaint(); // this.repaint();
} }
} }