This commit is contained in:
Cameron Taylor 2021-04-18 05:26:52 -04:00
commit 5bc6bebb67
7 changed files with 53 additions and 37 deletions

View file

@ -224,8 +224,8 @@ class Alphabet extends FlxSpriteGroup
{
var scaledY = FlxMath.remapToRange(targetY, 0, 1, 0, 1.3);
y = FlxMath.lerp(y, (scaledY * 120) + (FlxG.height * 0.48), 0.16);
x = FlxMath.lerp(x, (targetY * 20) + 90, 0.16);
y = CoolUtil.coolLerp(y, (scaledY * 120) + (FlxG.height * 0.48), 0.16);
x = CoolUtil.coolLerp(x, (targetY * 20) + 90, 0.16);
}
super.update(elapsed);

View file

@ -55,4 +55,12 @@ class CoolUtil
{
return lerp * (FlxG.elapsed / (1 / 60));
}
/*
* just lerp that does camLerpShit for u so u dont have to do it every time
*/
public static function coolLerp(a:Float, b:Float, ratio:Float):Float
{
return FlxMath.lerp(a, b, camLerpShit(ratio));
}
}

View file

@ -26,7 +26,7 @@ class FreeplayState extends MusicBeatState
var scoreText:FlxText;
var diffText:FlxText;
var lerpScore:Int = 0;
var lerpScore:Float = 0;
var intendedScore:Int = 0;
var coolColors:Array<Int> = [
@ -204,13 +204,10 @@ class FreeplayState extends MusicBeatState
}
}
lerpScore = Math.floor(FlxMath.lerp(lerpScore, intendedScore, 0.4));
bg.color = FlxColor.interpolate(bg.color, coolColors[songs[curSelected].week % coolColors.length], 0.045);
lerpScore = CoolUtil.coolLerp(lerpScore, intendedScore, 0.4);
bg.color = FlxColor.interpolate(bg.color, coolColors[songs[curSelected].week % coolColors.length], CoolUtil.camLerpShit(0.045));
if (Math.abs(lerpScore - intendedScore) <= 10)
lerpScore = intendedScore;
scoreText.text = "PERSONAL BEST:" + lerpScore;
scoreText.text = "PERSONAL BEST:" + Math.round(lerpScore);
positionHighscore();
@ -237,6 +234,7 @@ class FreeplayState extends MusicBeatState
if (controls.BACK)
{
FlxG.sound.play(Paths.sound('cancelMenu'));
FlxG.switchState(new MainMenuState());
}

View file

@ -36,7 +36,7 @@ class MenuItem extends FlxSpriteGroup
override function update(elapsed:Float)
{
super.update(elapsed);
y = FlxMath.lerp(y, (targetY * 120) + 480, 0.17);
y = CoolUtil.coolLerp(y, (targetY * 120) + 480, 0.17);
if (isFlashing)
flashingInt += 1;

View file

@ -1382,10 +1382,13 @@ class PlayState extends MusicBeatState
var senpaiEvil:FlxSprite = new FlxSprite();
senpaiEvil.frames = Paths.getSparrowAtlas('weeb/senpaiCrazy');
senpaiEvil.animation.addByPrefix('idle', 'Senpai Pre Explosion', 24, false);
senpaiEvil.setGraphicSize(Std.int(senpaiEvil.width * 6));
senpaiEvil.setGraphicSize(Std.int(senpaiEvil.width * daPixelZoom));
senpaiEvil.scrollFactor.set();
senpaiEvil.updateHitbox();
senpaiEvil.screenCenter();
senpaiEvil.x += senpaiEvil.width / 5;
camFollow.setPosition(camPos.x, camPos.y);
if (SONG.song.toLowerCase() == 'roses' || SONG.song.toLowerCase() == 'thorns')
{
@ -1394,6 +1397,7 @@ class PlayState extends MusicBeatState
if (SONG.song.toLowerCase() == 'thorns')
{
add(red);
camHUD.visible = false;
}
}
@ -1432,6 +1436,7 @@ class PlayState extends MusicBeatState
FlxG.camera.fade(FlxColor.WHITE, 0.01, true, function()
{
add(dialogueBox);
camHUD.visible = true;
}, true);
});
new FlxTimer().start(3.2, function(deadTime:FlxTimer)
@ -2190,16 +2195,16 @@ class PlayState extends MusicBeatState
if (daNote.animation.curAnim.name.endsWith("end") && daNote.prevNote != null)
daNote.y += daNote.prevNote.height;
else
daNote.y += daNote.height / daNote.scale.y;
daNote.y += daNote.height / 2;
if ((!daNote.mustPress || (daNote.wasGoodHit || (daNote.prevNote.wasGoodHit && !daNote.canBeHit)))
&& daNote.y - daNote.offset.y * daNote.scale.y + daNote.height >= strumLineMid)
{
// div by scale because cliprect is affected by scale i THINK
var swagRect:FlxRect = new FlxRect(0, 0, daNote.width / daNote.scale.x, daNote.height / daNote.scale.y);
// clipRect is applied to graphic itself so use frame Heights
var swagRect:FlxRect = new FlxRect(0, 0, daNote.frameWidth, daNote.frameHeight);
swagRect.height = (strumLineMid - daNote.y) / daNote.scale.y;
swagRect.y = daNote.height / daNote.scale.y - swagRect.height;
swagRect.y = daNote.frameHeight - swagRect.height;
daNote.clipRect = swagRect;
}
}
@ -2351,6 +2356,12 @@ class PlayState extends MusicBeatState
trace('LOADING NEXT SONG');
trace(storyPlaylist[0].toLowerCase() + difficulty);
FlxTransitionableState.skipNextTransIn = true;
FlxTransitionableState.skipNextTransOut = true;
FlxG.sound.music.stop();
vocals.stop();
if (SONG.song.toLowerCase() == 'eggnog')
{
var blackShit:FlxSprite = new FlxSprite(-FlxG.width * FlxG.camera.zoom,
@ -2358,20 +2369,24 @@ class PlayState extends MusicBeatState
blackShit.scrollFactor.set();
add(blackShit);
camHUD.visible = false;
inCutscene = true;
FlxG.sound.play(Paths.sound('Lights_Shut_off'));
FlxG.sound.play(Paths.sound('Lights_Shut_off'), function()
{
// no camFollow so it centers on horror tree
SONG = Song.loadFromJson(storyPlaylist[0].toLowerCase() + difficulty, storyPlaylist[0]);
LoadingState.loadAndSwitchState(new PlayState());
});
}
FlxTransitionableState.skipNextTransIn = true;
FlxTransitionableState.skipNextTransOut = true;
else
{
prevCamFollow = camFollow;
SONG = Song.loadFromJson(storyPlaylist[0].toLowerCase() + difficulty, storyPlaylist[0]);
FlxG.sound.music.stop();
LoadingState.loadAndSwitchState(new PlayState());
}
}
}
else
{
trace('WENT BACK TO FREEPLAY??');
@ -2380,8 +2395,6 @@ class PlayState extends MusicBeatState
}
}
var endingSong:Bool = false;
private function popUpScore(strumtime:Float, daNote:Note):Void
{
var noteDiff:Float = Math.abs(strumtime - Conductor.songPosition);
@ -2564,10 +2577,7 @@ class PlayState extends MusicBeatState
{
case 'mom':
camFollow.y = dad.getMidpoint().y;
case 'senpai':
camFollow.y = dad.getMidpoint().y - 430;
camFollow.x = dad.getMidpoint().x - 100;
case 'senpai-angry':
case 'senpai' | 'senpai-angry':
camFollow.y = dad.getMidpoint().y - 430;
camFollow.x = dad.getMidpoint().x - 100;
}

View file

@ -228,12 +228,9 @@ class StoryMenuState extends MusicBeatState
override function update(elapsed:Float)
{
// scoreText.setFormat('VCR OSD Mono', 32);
lerpScore = Math.floor(FlxMath.lerp(lerpScore, intendedScore, 0.5));
lerpScore = CoolUtil.coolLerp(lerpScore, intendedScore, 0.5);
if (Math.abs(lerpScore - intendedScore) <= 10)
lerpScore = intendedScore;
scoreText.text = "WEEK SCORE:" + lerpScore;
scoreText.text = "WEEK SCORE:" + Math.round(lerpScore);
txtWeekTitle.text = weekNames[curWeek].toUpperCase();
txtWeekTitle.x = FlxG.width - (txtWeekTitle.width + 10);
@ -369,7 +366,7 @@ class StoryMenuState extends MusicBeatState
FlxTween.tween(sprDifficulty, {y: leftArrow.y + 15, alpha: 1}, 0.07);
}
var lerpScore:Int = 0;
var lerpScore:Float = 0;
var intendedScore:Int = 0;
function changeWeek(change:Int = 0):Void

View file

@ -137,8 +137,11 @@ class Page extends FlxGroup
function updateEnabled(elapsed:Float)
{
if (canExit && controls.BACK)
{
FlxG.sound.play(Paths.sound('cancelMenu'));
exit();
}
}
function set_enabled(value:Bool)
{