v3.1.1: various stability improvements for low/inconsistent FPS:
- game now has a max delta time of 200ms - added some checks to ensure non-looped animations do not complete twice - adjusted 'enemy' reference in hero to 'attackTarget'
This commit is contained in:
@@ -283,7 +283,9 @@ public class Game implements ApplicationListener {
|
||||
}
|
||||
|
||||
protected void update() {
|
||||
Game.elapsed = Game.timeScale * Gdx.graphics.getDeltaTime();
|
||||
//game will not process more than 200ms of graphics time per frame
|
||||
float frameDelta = Math.min(0.2f, Gdx.graphics.getDeltaTime());
|
||||
Game.elapsed = Game.timeScale * frameDelta;
|
||||
Game.timeTotal += Game.elapsed;
|
||||
|
||||
Game.realTime = TimeUtils.millis();
|
||||
|
||||
@@ -63,9 +63,11 @@ public class MovieClip extends Image {
|
||||
while (frameTimer > curAnim.delay) {
|
||||
frameTimer -= curAnim.delay;
|
||||
if (curFrame >= curAnim.frames.length - 1) {
|
||||
curFrame = curAnim.frames.length - 1;
|
||||
if (curAnim.looped) {
|
||||
curFrame = 0;
|
||||
} else {
|
||||
curFrame = curAnim.frames.length - 1;
|
||||
frameTimer = 0;
|
||||
}
|
||||
finished = true;
|
||||
if (listener != null) {
|
||||
|
||||
Reference in New Issue
Block a user