freeplay exiting stuff

This commit is contained in:
Cameron Taylor 2023-03-15 21:05:15 -04:00
parent 9403eb4957
commit 014a8f320b
2 changed files with 182 additions and 71 deletions

View file

@ -70,9 +70,8 @@ class FreeplayState extends MusicBeatSubstate
var dj:DJBoyfriend; var dj:DJBoyfriend;
var iconArray:Array<HealthIcon> = [];
var typing:FlxInputText; var typing:FlxInputText;
var exitMovers:Map<FlxSprite, MoveData> = new Map();
override function create() override function create()
{ {
@ -133,6 +132,14 @@ class FreeplayState extends MusicBeatSubstate
pinkBack.color = 0xFFffd4e9; // sets it to pink! pinkBack.color = 0xFFffd4e9; // sets it to pink!
pinkBack.x -= pinkBack.width; pinkBack.x -= pinkBack.width;
exitMovers.set(pinkBack,
{
x: -pinkBack.width,
y: pinkBack.y,
speed: 0.4,
wait: 0
});
FlxTween.tween(pinkBack, {x: 0}, 0.6, {ease: FlxEase.quartOut}); FlxTween.tween(pinkBack, {x: 0}, 0.6, {ease: FlxEase.quartOut});
add(pinkBack); add(pinkBack);
@ -155,30 +162,84 @@ class FreeplayState extends MusicBeatSubstate
moreWays.speed = 4; moreWays.speed = 4;
grpTxtScrolls.add(moreWays); grpTxtScrolls.add(moreWays);
exitMovers.set(moreWays,
{
x: FlxG.width,
y: moreWays.y,
speed: 0.3,
wait: 0
});
var funnyScroll:BGScrollingText = new BGScrollingText(0, 250, "BOYFRIEND", FlxG.width / 2); var funnyScroll:BGScrollingText = new BGScrollingText(0, 250, "BOYFRIEND", FlxG.width / 2);
funnyScroll.funnyColor = 0xFFff9963; funnyScroll.funnyColor = 0xFFff9963;
funnyScroll.speed = -1; funnyScroll.speed = -1;
grpTxtScrolls.add(funnyScroll); grpTxtScrolls.add(funnyScroll);
exitMovers.set(funnyScroll,
{
x: -funnyScroll.width,
y: funnyScroll.y,
speed: 0.3,
wait: 0
});
var txtNuts:BGScrollingText = new BGScrollingText(0, 300, "PROTECT YO NUTS", FlxG.width / 2); var txtNuts:BGScrollingText = new BGScrollingText(0, 300, "PROTECT YO NUTS", FlxG.width / 2);
grpTxtScrolls.add(txtNuts); grpTxtScrolls.add(txtNuts);
exitMovers.set(txtNuts,
{
x: FlxG.width,
y: txtNuts.y,
speed: 0.3,
wait: 0
});
var funnyScroll2:BGScrollingText = new BGScrollingText(0, 340, "BOYFRIEND", FlxG.width / 2); var funnyScroll2:BGScrollingText = new BGScrollingText(0, 340, "BOYFRIEND", FlxG.width / 2);
funnyScroll2.funnyColor = 0xFFff9963; funnyScroll2.funnyColor = 0xFFff9963;
funnyScroll2.speed = -1.2; funnyScroll2.speed = -1.2;
grpTxtScrolls.add(funnyScroll2); grpTxtScrolls.add(funnyScroll2);
exitMovers.set(funnyScroll2,
{
x: -funnyScroll2.width,
y: funnyScroll2.y,
speed: 0.3,
wait: 0
});
var moreWays2:BGScrollingText = new BGScrollingText(0, 400, "HOT BLOODED IN MORE WAYS THAN ONE", FlxG.width); var moreWays2:BGScrollingText = new BGScrollingText(0, 400, "HOT BLOODED IN MORE WAYS THAN ONE", FlxG.width);
moreWays2.funnyColor = 0xFFfff383; moreWays2.funnyColor = 0xFFfff383;
moreWays2.speed = 4.4; moreWays2.speed = 4.4;
grpTxtScrolls.add(moreWays2); grpTxtScrolls.add(moreWays2);
exitMovers.set(moreWays2,
{
x: FlxG.width,
y: moreWays2.y,
speed: 0.3,
wait: 0
});
var funnyScroll3:BGScrollingText = new BGScrollingText(0, orangeBackShit.y, "BOYFRIEND", FlxG.width / 2); var funnyScroll3:BGScrollingText = new BGScrollingText(0, orangeBackShit.y, "BOYFRIEND", FlxG.width / 2);
funnyScroll3.funnyColor = 0xFFff9963; funnyScroll3.funnyColor = 0xFFff9963;
funnyScroll3.speed = -0.8; funnyScroll3.speed = -0.8;
grpTxtScrolls.add(funnyScroll3); grpTxtScrolls.add(funnyScroll3);
exitMovers.set(funnyScroll3,
{
x: -funnyScroll3.width,
y: funnyScroll3.y,
speed: 0.3,
wait: 0
});
dj = new DJBoyfriend(0, -100); dj = new DJBoyfriend(0, -100);
exitMovers.set(dj,
{
x: -dj.width * 1.6,
y: dj.y,
speed: 0.5,
wait: 0
});
add(dj); add(dj);
var bgDad:FlxSprite = new FlxSprite(pinkBack.width * 0.75, 0).loadGraphic(Paths.image('freeplay/freeplayBGdad')); var bgDad:FlxSprite = new FlxSprite(pinkBack.width * 0.75, 0).loadGraphic(Paths.image('freeplay/freeplayBGdad'));
@ -187,9 +248,25 @@ class FreeplayState extends MusicBeatSubstate
bgDad.shader = new AngleMask(); bgDad.shader = new AngleMask();
bgDad.visible = false; bgDad.visible = false;
exitMovers.set(bgDad,
{
x: FlxG.width * 1.5,
y: 0,
speed: 0.5,
wait: 0
});
var blackOverlayBullshitLOLXD:FlxSprite = new FlxSprite(FlxG.width).makeGraphic(Std.int(bgDad.width), Std.int(bgDad.height), FlxColor.BLACK); var blackOverlayBullshitLOLXD:FlxSprite = new FlxSprite(FlxG.width).makeGraphic(Std.int(bgDad.width), Std.int(bgDad.height), FlxColor.BLACK);
add(blackOverlayBullshitLOLXD); // used to mask the text lol! add(blackOverlayBullshitLOLXD); // used to mask the text lol!
exitMovers.set(blackOverlayBullshitLOLXD,
{
x: FlxG.width * 1.5,
y: bgDad.height,
speed: 0.5,
wait: 0
});
add(bgDad); add(bgDad);
FlxTween.tween(blackOverlayBullshitLOLXD, {x: pinkBack.width * 0.75}, 1, {ease: FlxEase.quintOut}); FlxTween.tween(blackOverlayBullshitLOLXD, {x: pinkBack.width * 0.75}, 1, {ease: FlxEase.quintOut});
@ -208,8 +285,7 @@ class FreeplayState extends MusicBeatSubstate
grpDifficulties.add(new FlxSprite().loadGraphic(Paths.image('freeplay/freeplayNorm'))); grpDifficulties.add(new FlxSprite().loadGraphic(Paths.image('freeplay/freeplayNorm')));
grpDifficulties.add(new FlxSprite().loadGraphic(Paths.image('freeplay/freeplayHard'))); grpDifficulties.add(new FlxSprite().loadGraphic(Paths.image('freeplay/freeplayHard')));
grpDifficulties.group.forEach(function(spr) grpDifficulties.group.forEach(function(spr) {
{
spr.visible = false; spr.visible = false;
}); });
@ -220,9 +296,26 @@ class FreeplayState extends MusicBeatSubstate
add(overhangStuff); add(overhangStuff);
FlxTween.tween(overhangStuff, {y: 0}, 0.3, {ease: FlxEase.quartOut}); FlxTween.tween(overhangStuff, {y: 0}, 0.3, {ease: FlxEase.quartOut});
exitMovers.set(overhangStuff,
{
y: -overhangStuff.height,
x: 0,
speed: 0.2,
wait: 0
});
var fnfFreeplay:FlxText = new FlxText(0, 12, 0, "FREEPLAY", 48); var fnfFreeplay:FlxText = new FlxText(0, 12, 0, "FREEPLAY", 48);
fnfFreeplay.font = "VCR OSD Mono"; fnfFreeplay.font = "VCR OSD Mono";
fnfFreeplay.visible = false; fnfFreeplay.visible = false;
exitMovers.set(fnfFreeplay,
{
y: fnfFreeplay.y - 64,
x: 0,
speed: 0.2,
wait: 0
});
var sillyStroke = new StrokeShader(0xFFFFFFFF, 2, 2); var sillyStroke = new StrokeShader(0xFFFFFFFF, 2, 2);
fnfFreeplay.shader = sillyStroke; fnfFreeplay.shader = sillyStroke;
add(fnfFreeplay); add(fnfFreeplay);
@ -236,8 +329,7 @@ class FreeplayState extends MusicBeatSubstate
fnfHighscoreSpr.updateHitbox(); fnfHighscoreSpr.updateHitbox();
add(fnfHighscoreSpr); add(fnfHighscoreSpr);
new FlxTimer().start(FlxG.random.float(12, 50), function(tmr) new FlxTimer().start(FlxG.random.float(12, 50), function(tmr) {
{
fnfHighscoreSpr.animation.play("highscore"); fnfHighscoreSpr.animation.play("highscore");
tmr.time = FlxG.random.float(20, 60); tmr.time = FlxG.random.float(20, 60);
}, 0); }, 0);
@ -251,8 +343,7 @@ class FreeplayState extends MusicBeatSubstate
txtCompletion.visible = false; txtCompletion.visible = false;
add(txtCompletion); add(txtCompletion);
dj.onIntroDone.add(function() dj.onIntroDone.add(function() {
{
FlxTween.tween(grpDifficulties, {x: 90}, 0.6, {ease: FlxEase.quartOut}); FlxTween.tween(grpDifficulties, {x: 90}, 0.6, {ease: FlxEase.quartOut});
add(new DifficultySelector(20, grpDifficulties.y - 10, false, controls)); add(new DifficultySelector(20, grpDifficulties.y - 10, false, controls));
@ -261,8 +352,7 @@ class FreeplayState extends MusicBeatSubstate
var letterSort:LetterSort = new LetterSort(300, 100); var letterSort:LetterSort = new LetterSort(300, 100);
add(letterSort); add(letterSort);
letterSort.changeSelectionCallback = (str) -> letterSort.changeSelectionCallback = (str) -> {
{
switch (str) switch (str)
{ {
case "fav": case "fav":
@ -274,8 +364,7 @@ class FreeplayState extends MusicBeatSubstate
} }
}; };
new FlxTimer().start(1 / 24, function(handShit) new FlxTimer().start(1 / 24, function(handShit) {
{
fnfHighscoreSpr.visible = true; fnfHighscoreSpr.visible = true;
fnfFreeplay.visible = true; fnfFreeplay.visible = true;
fp.visible = true; fp.visible = true;
@ -284,8 +373,7 @@ class FreeplayState extends MusicBeatSubstate
txtCompletion.visible = true; txtCompletion.visible = true;
intendedCompletion = 0; intendedCompletion = 0;
new FlxTimer().start(1.5 / 24, function(bold) new FlxTimer().start(1.5 / 24, function(bold) {
{
sillyStroke.width = 0; sillyStroke.width = 0;
sillyStroke.height = 0; sillyStroke.height = 0;
}); });
@ -333,14 +421,12 @@ class FreeplayState extends MusicBeatSubstate
typing = new FlxInputText(100, 100); typing = new FlxInputText(100, 100);
add(typing); add(typing);
typing.callback = function(txt, action) typing.callback = function(txt, action) {
{
// generateSongList(new EReg(txt.trim(), "ig")); // generateSongList(new EReg(txt.trim(), "ig"));
trace(action); trace(action);
}; };
forEach(function(bs) forEach(function(bs) {
{
bs.cameras = [funnyCam]; bs.cameras = [funnyCam];
}); });
@ -361,15 +447,13 @@ class FreeplayState extends MusicBeatSubstate
switch (filterStuff.filterType) switch (filterStuff.filterType)
{ {
case STARTSWITH: case STARTSWITH:
tempSongs = tempSongs.filter(str -> tempSongs = tempSongs.filter(str -> {
{
return str.songName.toLowerCase().startsWith(filterStuff.filterData); return str.songName.toLowerCase().startsWith(filterStuff.filterData);
}); });
case ALL: case ALL:
// no filter! // no filter!
case FAVORITE: case FAVORITE:
tempSongs = tempSongs.filter(str -> tempSongs = tempSongs.filter(str -> {
{
return str.isFav; return str.isFav;
}); });
default: default:
@ -406,20 +490,17 @@ class FreeplayState extends MusicBeatSubstate
var maxTimer:Float = Math.min(i, 4); var maxTimer:Float = Math.min(i, 4);
new FlxTimer().start((1 / 24) * maxTimer, function(doShit) new FlxTimer().start((1 / 24) * maxTimer, function(doShit) {
{
funnyMenu.doJumpIn = true; funnyMenu.doJumpIn = true;
}); });
new FlxTimer().start((0.09 * maxTimer) + 0.85, function(lerpTmr) new FlxTimer().start((0.09 * maxTimer) + 0.85, function(lerpTmr) {
{
funnyMenu.doLerp = true; funnyMenu.doLerp = true;
}); });
if (!force) if (!force)
{ {
new FlxTimer().start(((0.20 * maxTimer) / (1 + maxTimer)) + 0.75, function(swagShi) new FlxTimer().start(((0.20 * maxTimer) / (1 + maxTimer)) + 0.75, function(swagShi) {
{
funnyMenu.songText.visible = true; funnyMenu.songText.visible = true;
funnyMenu.alpha = 1; funnyMenu.alpha = 1;
}); });
@ -439,13 +520,6 @@ class FreeplayState extends MusicBeatSubstate
// grpSongs.add(songText); // grpSongs.add(songText);
var icon:HealthIcon = new HealthIcon(tempSongs[i].songCharacter);
// icon.sprTracker = songText;
// using a FlxGroup is too much fuss!
iconArray.push(icon);
// add(icon);
// songText.x += 40; // songText.x += 40;
// DONT PUT X IN THE FIRST PARAMETER OF new ALPHABET() !! // DONT PUT X IN THE FIRST PARAMETER OF new ALPHABET() !!
// songText.screenCenter(X); // songText.screenCenter(X);
@ -500,8 +574,7 @@ class FreeplayState extends MusicBeatSubstate
FlxTween.tween(grpCapsules.members[realShit], {angle: 360}, 0.4, FlxTween.tween(grpCapsules.members[realShit], {angle: 360}, 0.4,
{ {
ease: FlxEase.elasticOut, ease: FlxEase.elasticOut,
onComplete: _ -> onComplete: _ -> {
{
grpCapsules.members[realShit].favIcon.visible = true; grpCapsules.members[realShit].favIcon.visible = true;
grpCapsules.members[realShit].favIcon.animation.play("fav"); grpCapsules.members[realShit].favIcon.animation.play("fav");
} }
@ -510,12 +583,10 @@ class FreeplayState extends MusicBeatSubstate
else else
{ {
grpCapsules.members[realShit].favIcon.animation.play('fav', false, true); grpCapsules.members[realShit].favIcon.animation.play('fav', false, true);
new FlxTimer().start((1 / 24) * 14, _ -> new FlxTimer().start((1 / 24) * 14, _ -> {
{
grpCapsules.members[realShit].favIcon.visible = false; grpCapsules.members[realShit].favIcon.visible = false;
}); });
new FlxTimer().start((1 / 24) * 24, _ -> new FlxTimer().start((1 / 24) * 24, _ -> {
{
FlxTween.tween(grpCapsules.members[realShit], {angle: 0}, 0.4, {ease: FlxEase.elasticOut}); FlxTween.tween(grpCapsules.members[realShit], {angle: 0}, 0.4, {ease: FlxEase.elasticOut});
}); });
} }
@ -537,7 +608,7 @@ class FreeplayState extends MusicBeatSubstate
fp.updateScore(Std.int(lerpScore)); fp.updateScore(Std.int(lerpScore));
txtCompletion.text = Math.floor(lerpCompletion * 100) + "%"; txtCompletion.text = Math.floor(lerpCompletion * 100) + "%";
trace(Highscore.getCompletion(songs[curSelected].songName, curDifficulty)); // trace(Highscore.getCompletion(songs[curSelected].songName, curDifficulty));
// trace(intendedScore); // trace(intendedScore);
// trace(lerpScore); // trace(lerpScore);
@ -565,7 +636,7 @@ class FreeplayState extends MusicBeatSubstate
FlxG.watch.addQuick("LENGTH", length); FlxG.watch.addQuick("LENGTH", length);
FlxG.watch.addQuick("ANGLE", Math.round(FlxAngle.asDegrees(angle))); FlxG.watch.addQuick("ANGLE", Math.round(FlxAngle.asDegrees(angle)));
trace("ANGLE", Math.round(FlxAngle.asDegrees(angle))); // trace("ANGLE", Math.round(FlxAngle.asDegrees(angle)));
} }
/* switch (inputID) /* switch (inputID)
@ -684,9 +755,30 @@ class FreeplayState extends MusicBeatSubstate
{ {
FlxG.sound.play(Paths.sound('cancelMenu')); FlxG.sound.play(Paths.sound('cancelMenu'));
FlxTransitionableState.skipNextTransIn = true; // FlxTween.tween(dj, {x: -dj.width}, 0.2, {ease: FlxEase.quartOut});
FlxTransitionableState.skipNextTransOut = true;
FlxG.switchState(new MainMenuState()); var longestTimer:Float = 0;
for (spr in exitMovers.keys())
{
var moveData:MoveData = exitMovers.get(spr);
FlxTween.tween(spr, {x: moveData.x, y: moveData.y}, moveData.speed, {ease: FlxEase.expoIn});
longestTimer = Math.max(longestTimer, moveData.speed + moveData.wait);
}
for (caps in grpCapsules.members)
{
caps.doJumpIn = false;
caps.doLerp = false;
caps.doJumpOut = true;
}
new FlxTimer().start(longestTimer, (_) -> {
FlxTransitionableState.skipNextTransIn = true;
FlxTransitionableState.skipNextTransOut = true;
FlxG.switchState(new MainMenuState());
});
} }
if (accepted) if (accepted)
@ -724,14 +816,13 @@ class FreeplayState extends MusicBeatSubstate
SongLoad.curDiff = PlayState.storyDifficulty_NEW; SongLoad.curDiff = PlayState.storyDifficulty_NEW;
PlayState.storyWeek = songs[curSelected].week; PlayState.storyWeek = songs[curSelected].week;
trace(' CUR WEEK ' + PlayState.storyWeek); // trace(' CUR WEEK ' + PlayState.storyWeek);
// Visual and audio effects. // Visual and audio effects.
FlxG.sound.play(Paths.sound('confirmMenu')); FlxG.sound.play(Paths.sound('confirmMenu'));
dj.confirm(); dj.confirm();
new FlxTimer().start(1, function(tmr:FlxTimer) new FlxTimer().start(1, function(tmr:FlxTimer) {
{
LoadingState.loadAndSwitchState(new PlayState(), true); LoadingState.loadAndSwitchState(new PlayState(), true);
}); });
} }
@ -769,8 +860,7 @@ class FreeplayState extends MusicBeatSubstate
'normal'; 'normal';
}; };
grpDifficulties.group.forEach(function(spr) grpDifficulties.group.forEach(function(spr) {
{
spr.visible = false; spr.visible = false;
}); });
@ -779,8 +869,7 @@ class FreeplayState extends MusicBeatSubstate
curShit.visible = true; curShit.visible = true;
curShit.offset.y += 5; curShit.offset.y += 5;
curShit.alpha = 0.5; curShit.alpha = 0.5;
new FlxTimer().start(1 / 24, function(swag) new FlxTimer().start(1 / 24, function(swag) {
{
curShit.alpha = 1; curShit.alpha = 1;
curShit.updateHitbox(); curShit.updateHitbox();
}); });
@ -826,13 +915,6 @@ class FreeplayState extends MusicBeatSubstate
var bullShit:Int = 0; var bullShit:Int = 0;
for (i in 0...iconArray.length)
{
iconArray[i].alpha = 0.6;
}
iconArray[curSelected].alpha = 1;
for (index => capsule in grpCapsules.members) for (index => capsule in grpCapsules.members)
{ {
capsule.selected = false; capsule.selected = false;
@ -884,8 +966,7 @@ class DifficultySelector extends FlxSprite
whiteShader.colorSet = true; whiteShader.colorSet = true;
new FlxTimer().start(2 / 24, function(tmr) new FlxTimer().start(2 / 24, function(tmr) {
{
whiteShader.colorSet = false; whiteShader.colorSet = false;
updateHitbox(); updateHitbox();
}); });
@ -920,3 +1001,11 @@ class SongMetadata
this.isFav = isFav; this.isFav = isFav;
} }
} }
typedef MoveData =
{
var x:Float;
var y:Float;
var speed:Float;
var wait:Float;
}

View file

@ -23,6 +23,8 @@ class SongMenuItem extends FlxSpriteGroup
public var doLerp:Bool = false; public var doLerp:Bool = false;
public var doJumpIn:Bool = false; public var doJumpIn:Bool = false;
public var doJumpOut:Bool = false;
public function new(x:Float, y:Float, song:String) public function new(x:Float, y:Float, song:String)
{ {
super(x, y); super(x, y);
@ -52,27 +54,47 @@ class SongMenuItem extends FlxSpriteGroup
selected = selected; // just to kickstart the set_selected selected = selected; // just to kickstart the set_selected
} }
var frameTicker:Float = 0; var frameInTicker:Float = 0;
var frameTypeBeat:Int = 0; var frameInTypeBeat:Int = 0;
var frameOutTicker:Float = 0;
var frameOutTypeBeat:Int = 0;
var xFrames:Array<Float> = [1.7, 1.8, 0.85, 0.85, 0.97, 0.97, 1]; var xFrames:Array<Float> = [1.7, 1.8, 0.85, 0.85, 0.97, 0.97, 1];
var xPosLerpLol:Array<Float> = [0.9, 0.4, 0.16, 0.16, 0.22, 0.22, 0.245]; // NUMBERS ARE JANK CUZ THE SCALING OR WHATEVER var xPosLerpLol:Array<Float> = [0.9, 0.4, 0.16, 0.16, 0.22, 0.22, 0.245]; // NUMBERS ARE JANK CUZ THE SCALING OR WHATEVER
var xPosOutLerpLol:Array<Float> = [0.245, 0.75, 0.98, 0.98, 1.2]; // NUMBERS ARE JANK CUZ THE SCALING OR WHATEVER
override function update(elapsed:Float) override function update(elapsed:Float)
{ {
if (doJumpIn) if (doJumpIn)
{ {
frameTicker += elapsed; frameInTicker += elapsed;
if (frameTicker >= 1 / 24 && frameTypeBeat < xFrames.length) if (frameInTicker >= 1 / 24 && frameInTypeBeat < xFrames.length)
{ {
frameTicker = 0; frameInTicker = 0;
scale.x = xFrames[frameTypeBeat]; scale.x = xFrames[frameInTypeBeat];
scale.y = 1 / xFrames[frameTypeBeat]; scale.y = 1 / xFrames[frameInTypeBeat];
x = FlxG.width * xPosLerpLol[Std.int(Math.min(frameTypeBeat, xPosLerpLol.length - 1))]; x = FlxG.width * xPosLerpLol[Std.int(Math.min(frameInTypeBeat, xPosLerpLol.length - 1))];
frameTypeBeat += 1; frameInTypeBeat += 1;
}
}
if (doJumpOut)
{
frameOutTicker += elapsed;
if (frameOutTicker >= 1 / 24 && frameOutTypeBeat < xFrames.length)
{
frameOutTicker = 0;
scale.x = xFrames[frameOutTypeBeat];
scale.y = 1 / xFrames[frameOutTypeBeat];
x = FlxG.width * xPosOutLerpLol[Std.int(Math.min(frameOutTypeBeat, xPosOutLerpLol.length - 1))];
frameOutTypeBeat += 1;
} }
} }