From 742a29259ac8ad66c1a7af01ee5bf9dbd06adba5 Mon Sep 17 00:00:00 2001 From: toksikk Date: Tue, 11 Nov 2014 15:58:38 +0100 Subject: [PATCH] =?UTF-8?q?Kleinere=20=C3=84nderungen=20und=20Pause-Versuc?= =?UTF-8?q?h?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- HeatUp/src/de/heatup/cfg/Config.java | 5 ++ .../de/heatup/mapengine/CollisionHandler.java | 2 - HeatUp/src/de/heatup/testing/GameLoopD.java | 57 ++++++++++++++++--- 3 files changed, 55 insertions(+), 9 deletions(-) diff --git a/HeatUp/src/de/heatup/cfg/Config.java b/HeatUp/src/de/heatup/cfg/Config.java index 439c9f5..7f888c8 100644 --- a/HeatUp/src/de/heatup/cfg/Config.java +++ b/HeatUp/src/de/heatup/cfg/Config.java @@ -4,6 +4,11 @@ package de.heatup.cfg; * Bitte hier eure Magicnumbers eintragen */ public class Config { + /* + * Attribute + * de.heatup.ui.GameLoop + */ + public static int currentTickNr = 0; /* * Attribute * de.heatup.mapengine.* diff --git a/HeatUp/src/de/heatup/mapengine/CollisionHandler.java b/HeatUp/src/de/heatup/mapengine/CollisionHandler.java index 6132a7f..b8ecfd6 100644 --- a/HeatUp/src/de/heatup/mapengine/CollisionHandler.java +++ b/HeatUp/src/de/heatup/mapengine/CollisionHandler.java @@ -65,9 +65,7 @@ public class CollisionHandler { public static void tick() { for (int i=1; i= 1) { - tick(); + if (!pause) { + tick(); + } updates++; delta--; } @@ -192,7 +227,7 @@ public class GameLoopD extends JFrame implements Runnable { frames++; try { - thread.sleep(10); // entlastet die cpu massiv. + thread.sleep(1); // entlastet die cpu massiv. } catch (InterruptedException e) { // TODO Auto-generated catch block @@ -211,11 +246,19 @@ public class GameLoopD extends JFrame implements Runnable { } // alles was geupdatet werden muss hier rein private void tick() { + if (Config.currentTickNr >= 60) { + Config.currentTickNr = 0; + } else { + Config.currentTickNr++; + } kb.checkKeyActivity(); player01.tick(); opponent01.tick(); opponent02.tick(); opponent03.tick(); + opponent04.tick(); + opponent05.tick(); + opponent06.tick(); CollisionHandler.tick(); } // alles was animiert wird hier rein (paints)