Skip to content

Commit

Permalink
Fixed timestep fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
sqirradotdev committed Sep 5, 2021
1 parent 6c7b839 commit 4c0318e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
6 changes: 6 additions & 0 deletions source/Init.hx
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,12 @@ class Init extends FlxState
// apply saved filters
FlxG.game.setFilters(filters);

// Some additional changes to default HaxeFlixel settings, both for ease of debugging
// and usability.
FlxG.fixedTimestep = false; // This ensures that the game is not tied to the FPS
FlxG.mouse.useSystemCursor = true; // Use system cursor because it's prettier
FlxG.mouse.visible = false; // Hide mouse on start

Main.switchState(this, new TitleState());
}

Expand Down
7 changes: 3 additions & 4 deletions source/gameFolder/meta/data/font/Alphabet.hx
Original file line number Diff line number Diff line change
Expand Up @@ -256,13 +256,12 @@ class Alphabet extends FlxSpriteGroup
{
var scaledY = FlxMath.remapToRange(targetY, 0, 1, 0, 1.3);

var lerpVal = Main.framerateAdjust(0.175);
y = FlxMath.lerp(y, (scaledY * 120) + (FlxG.height * 0.48), lerpVal);
y = FlxMath.lerp(y, (scaledY * 120) + (FlxG.height * 0.48), elapsed * 6);
// lmao
if (!disableX)
x = FlxMath.lerp(x, (targetY * 20) + 90, lerpVal);
x = FlxMath.lerp(x, (targetY * 20) + 90, elapsed * 6);
else
x = FlxMath.lerp(x, xTo, lerpVal);
x = FlxMath.lerp(x, xTo, elapsed * 6);
}

if ((text != textInit))
Expand Down
6 changes: 4 additions & 2 deletions source/gameFolder/meta/state/PlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,8 @@ class PlayState extends MusicBeatState

super.update(elapsed);

FlxG.camera.followLerp = elapsed * 2;

if (health > 2)
health = 2;

Expand Down Expand Up @@ -376,15 +378,15 @@ class PlayState extends MusicBeatState
{
if (startedCountdown)
{
Conductor.songPosition += FlxG.elapsed * 1000;
Conductor.songPosition += elapsed * 1000;
if (Conductor.songPosition >= 0)
startSong();
}
}
else
{
// Conductor.songPosition = FlxG.sound.music.time;
Conductor.songPosition += FlxG.elapsed * 1000;
Conductor.songPosition += elapsed * 1000;

if (!paused)
{
Expand Down

0 comments on commit 4c0318e

Please sign in to comment.