diff --git a/src/sig/RabiClone.java b/src/sig/RabiClone.java index 2936810..83fe252 100644 --- a/src/sig/RabiClone.java +++ b/src/sig/RabiClone.java @@ -92,8 +92,8 @@ public class RabiClone{ lastGameTime=System.nanoTime(); - while (dt>=(1/244d)*1000000000) { - double updateMult = 1/244d; + while (dt>=(1/244d)*1000000000l) { + final double updateMult = 1/244d; handleGameControllers(); KeyBind.poll(); @@ -129,10 +129,14 @@ public class RabiClone{ OBJ.remove(i--); } } - dt-=(1/244d)*1000000000; + dt-=(1/244d)*1000000000l; } - if (dt<0) { - dt=0; + if (dt<(1/244d)*1000000000l) { + lastReportedTime=System.currentTimeMillis(); + } else + if (System.currentTimeMillis()-lastReportedTime>5000) { + System.out.println("WARNING! Game is lagging behind! Frames Behind: "+(dt/((1/244d)*1000000000l))); + lastReportedTime=System.currentTimeMillis(); } } } diff --git a/src/sig/objects/Player.java b/src/sig/objects/Player.java index d8125c8..d44c1ea 100644 --- a/src/sig/objects/Player.java +++ b/src/sig/objects/Player.java @@ -395,6 +395,7 @@ public class Player extends AnimatedObject{ groundCollision=true; collisionOccured=true; state = State.IDLE; + break; } } if (!collisionOccured) {