diff --git a/marblegame.hl b/marblegame.hl index e6906aaa..51136fd7 100644 Binary files a/marblegame.hl and b/marblegame.hl differ diff --git a/src/Main.hx b/src/Main.hx index 73ba7b02..25dc703a 100644 --- a/src/Main.hx +++ b/src/Main.hx @@ -35,7 +35,7 @@ class Main extends hxd.App { override function update(dt:Float) { super.update(dt); - marbleGame.update(hxd.Timer.dt); + marbleGame.update(dt); // world.update(dt); fpsCounter.text = 'FPS: ${this.engine.fps}'; } diff --git a/src/PathedInterior.hx b/src/PathedInterior.hx index 8fb76c5c..2cd4e55a 100644 --- a/src/PathedInterior.hx +++ b/src/PathedInterior.hx @@ -146,18 +146,21 @@ class PathedInterior extends InteriorObject { // currentPosition: currentPosition, // velocity: velocity // }; + + var thisTime = timeState.currentAttemptTime; + if (stopped) { - currentTime = stopTime; + thisTime = stopTime; popTickState(); } - var transform = this.getTransformAtTime(this.getInternalTime(timeState.currentAttemptTime)); + var transform = this.getTransformAtTime(this.getInternalTime(thisTime)); var position = transform.getPosition(); this.prevPosition = this.currentPosition; this.currentPosition = position; if (!stopped) { - this.stopTime = currentTime; + this.stopTime = timeState.currentAttemptTime; pushTickState(); } // if (!stopped) @@ -175,9 +178,12 @@ class PathedInterior extends InteriorObject { } public function recomputeVelocity(currentTime:Float, dt:Float) { - var transform = this.getTransformAtTime(this.getInternalTime(currentTime)); + var thisTime = currentTime; + + var transform = this.getTransformAtTime(this.getInternalTime(thisTime)); var position = transform.getPosition(); velocity = position.sub(this.currentPosition).multiply(1 / dt); + this.collider.velocity = velocity; } public function pushTickState() { @@ -198,6 +204,7 @@ class PathedInterior extends InteriorObject { this.prevPosition = this.previousState.prevPosition; this.currentPosition = this.previousState.currentPosition; this.velocity = this.previousState.velocity; + this.collider.velocity = this.velocity; // this.updatePosition(); }