1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-11-23 23:33:55 +00:00

camera movement lerp fix for high framerates

This commit is contained in:
Cameron Taylor 2021-03-24 22:41:41 -04:00
parent 2fdea58951
commit 7766ddf9bd

View file

@ -1387,6 +1387,9 @@ class PlayState extends MusicBeatState
override public function update(elapsed:Float) override public function update(elapsed:Float)
{ {
// makes the lerp non-dependant on the framerate
FlxG.camera.followLerp = 0.04 * (elapsed / (1 / 60));
#if !debug #if !debug
perfectMode = false; perfectMode = false;
#end #end
@ -1519,60 +1522,7 @@ class PlayState extends MusicBeatState
if (generatedMusic && PlayState.SONG.notes[Std.int(curStep / 16)] != null) if (generatedMusic && PlayState.SONG.notes[Std.int(curStep / 16)] != null)
{ {
if (curBeat % 4 == 0) cameraMovement();
{
// trace(PlayState.SONG.notes[Std.int(curStep / 16)].mustHitSection);
}
if (camFollow.x != dad.getMidpoint().x + 150 && !PlayState.SONG.notes[Std.int(curStep / 16)].mustHitSection)
{
camFollow.setPosition(dad.getMidpoint().x + 150, dad.getMidpoint().y - 100);
// camFollow.setPosition(lucky.getMidpoint().x - 120, lucky.getMidpoint().y + 210);
switch (dad.curCharacter)
{
case 'mom':
camFollow.y = dad.getMidpoint().y;
case 'senpai':
camFollow.y = dad.getMidpoint().y - 430;
camFollow.x = dad.getMidpoint().x - 100;
case 'senpai-angry':
camFollow.y = dad.getMidpoint().y - 430;
camFollow.x = dad.getMidpoint().x - 100;
}
if (dad.curCharacter == 'mom')
vocals.volume = 1;
if (SONG.song.toLowerCase() == 'tutorial')
{
tweenCamIn();
}
}
if (PlayState.SONG.notes[Std.int(curStep / 16)].mustHitSection && camFollow.x != boyfriend.getMidpoint().x - 100)
{
camFollow.setPosition(boyfriend.getMidpoint().x - 100, boyfriend.getMidpoint().y - 100);
switch (curStage)
{
case 'limo':
camFollow.x = boyfriend.getMidpoint().x - 300;
case 'mall':
camFollow.y = boyfriend.getMidpoint().y - 200;
case 'school':
camFollow.x = boyfriend.getMidpoint().x - 200;
camFollow.y = boyfriend.getMidpoint().y - 200;
case 'schoolEvil':
camFollow.x = boyfriend.getMidpoint().x - 200;
camFollow.y = boyfriend.getMidpoint().y - 200;
}
if (SONG.song.toLowerCase() == 'tutorial')
{
FlxTween.tween(FlxG.camera, {zoom: 1}, (Conductor.stepCrochet * 4 / 1000), {ease: FlxEase.elasticInOut});
}
}
} }
if (camZooming) if (camZooming)
@ -1994,6 +1944,59 @@ class PlayState extends MusicBeatState
curSection += 1; curSection += 1;
} }
function cameraMovement()
{
if (camFollow.x != dad.getMidpoint().x + 150 && !PlayState.SONG.notes[Std.int(curStep / 16)].mustHitSection)
{
camFollow.setPosition(dad.getMidpoint().x + 150, dad.getMidpoint().y - 100);
// camFollow.setPosition(lucky.getMidpoint().x - 120, lucky.getMidpoint().y + 210);
switch (dad.curCharacter)
{
case 'mom':
camFollow.y = dad.getMidpoint().y;
case 'senpai':
camFollow.y = dad.getMidpoint().y - 430;
camFollow.x = dad.getMidpoint().x - 100;
case 'senpai-angry':
camFollow.y = dad.getMidpoint().y - 430;
camFollow.x = dad.getMidpoint().x - 100;
}
if (dad.curCharacter == 'mom')
vocals.volume = 1;
if (SONG.song.toLowerCase() == 'tutorial')
{
tweenCamIn();
}
}
if (PlayState.SONG.notes[Std.int(curStep / 16)].mustHitSection && camFollow.x != boyfriend.getMidpoint().x - 100)
{
camFollow.setPosition(boyfriend.getMidpoint().x - 100, boyfriend.getMidpoint().y - 100);
switch (curStage)
{
case 'limo':
camFollow.x = boyfriend.getMidpoint().x - 300;
case 'mall':
camFollow.y = boyfriend.getMidpoint().y - 200;
case 'school':
camFollow.x = boyfriend.getMidpoint().x - 200;
camFollow.y = boyfriend.getMidpoint().y - 200;
case 'schoolEvil':
camFollow.x = boyfriend.getMidpoint().x - 200;
camFollow.y = boyfriend.getMidpoint().y - 200;
}
if (SONG.song.toLowerCase() == 'tutorial')
{
FlxTween.tween(FlxG.camera, {zoom: 1}, (Conductor.stepCrochet * 4 / 1000), {ease: FlxEase.elasticInOut});
}
}
}
private function keyShit():Void private function keyShit():Void
{ {
// HOLDING // HOLDING