mirror of
https://github.com/jokerx3/HeatUp
synced 2026-07-27 10:19:46 +02:00
Kleine Gameloop-Änderung.
Getter für player Objekt hinzugefügt!
This commit is contained in:
@@ -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--;
|
||||||
}
|
}
|
||||||
@@ -231,8 +233,7 @@ public class GameLoopD extends JFrame implements Runnable {
|
|||||||
frames++;
|
frames++;
|
||||||
|
|
||||||
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();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user