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); var scaledY = FlxMath.remapToRange(targetY, 0, 1, 0, 1.3);
y = FlxMath.lerp(y, (scaledY * 120) + (FlxG.height * 0.48), 0.16); y = CoolUtil.coolLerp(y, (scaledY * 120) + (FlxG.height * 0.48), 0.16);
x = FlxMath.lerp(x, (targetY * 20) + 90, 0.16); x = CoolUtil.coolLerp(x, (targetY * 20) + 90, 0.16);
} }
super.update(elapsed); super.update(elapsed);

View file

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

View file

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

View file

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

View file

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

View file

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