2022-09-20 06:16:12 +00:00
|
|
|
package funkin.play;
|
|
|
|
|
2022-09-22 01:03:31 +00:00
|
|
|
import flixel.FlxBasic;
|
2022-09-20 06:16:12 +00:00
|
|
|
import flixel.FlxSprite;
|
2022-09-21 22:00:43 +00:00
|
|
|
import flixel.graphics.frames.FlxAtlasFrames;
|
2022-09-20 06:16:12 +00:00
|
|
|
import flixel.text.FlxText;
|
2022-09-21 22:00:43 +00:00
|
|
|
import flixel.tweens.FlxEase;
|
|
|
|
import flixel.tweens.FlxTween;
|
|
|
|
import flixel.util.FlxColor;
|
|
|
|
import flixel.util.FlxGradient;
|
|
|
|
import flixel.util.FlxTimer;
|
2022-09-20 06:16:12 +00:00
|
|
|
|
|
|
|
class ResultState extends MusicBeatSubstate
|
|
|
|
{
|
2022-09-20 17:18:40 +00:00
|
|
|
var resultsVariation:ResultVariations;
|
|
|
|
|
2022-09-20 06:16:12 +00:00
|
|
|
override function create()
|
|
|
|
{
|
2022-09-20 17:18:40 +00:00
|
|
|
if (Highscore.tallies.sick == Highscore.tallies.totalNotes && Highscore.tallies.maxCombo == Highscore.tallies.totalNotes)
|
|
|
|
resultsVariation = PERFECT;
|
|
|
|
else if (Highscore.tallies.missed + Highscore.tallies.bad + Highscore.tallies.shit >= Highscore.tallies.totalNotes * 0.50)
|
|
|
|
resultsVariation = SHIT; // if more than half of your song was missed, bad, or shit notes, you get shit ending!
|
|
|
|
else
|
|
|
|
resultsVariation = NORMAL;
|
|
|
|
|
|
|
|
FlxG.sound.playMusic(Paths.music("results" + resultsVariation));
|
2022-09-20 17:01:37 +00:00
|
|
|
|
2022-09-22 00:26:16 +00:00
|
|
|
// TEMP-ish, just used to sorta "cache" the 3000x3000 image!
|
|
|
|
var cacheBullShit = new FlxSprite().loadGraphic(Paths.image("resultScreen/soundSystem"));
|
|
|
|
add(cacheBullShit);
|
|
|
|
|
2022-09-21 22:00:43 +00:00
|
|
|
var bg:FlxSprite = FlxGradient.createGradientFlxSprite(FlxG.width, FlxG.height, [0xFFFECC5C, 0xFFFDC05C], 90);
|
2022-09-20 06:16:12 +00:00
|
|
|
bg.scrollFactor.set();
|
|
|
|
add(bg);
|
2022-09-21 22:00:43 +00:00
|
|
|
|
2022-09-22 00:26:16 +00:00
|
|
|
var soundSystem:FlxSprite = new FlxSprite(-15, -180);
|
|
|
|
soundSystem.frames = Paths.getSparrowAtlas("resultScreen/soundSystem");
|
|
|
|
soundSystem.animation.addByPrefix("idle", "sound system", 24, false);
|
|
|
|
soundSystem.visible = false;
|
|
|
|
new FlxTimer().start(0.4, _ ->
|
|
|
|
{
|
|
|
|
soundSystem.animation.play("idle");
|
|
|
|
soundSystem.visible = true;
|
|
|
|
});
|
|
|
|
add(soundSystem);
|
|
|
|
|
2022-09-22 01:03:31 +00:00
|
|
|
var difficulty:FlxSprite = new FlxSprite(680);
|
|
|
|
|
|
|
|
var diffSpr:String = switch (CoolUtil.difficultyString())
|
|
|
|
{
|
|
|
|
case "EASY":
|
|
|
|
"difEasy";
|
|
|
|
case "NORMAL":
|
|
|
|
"difNormal";
|
|
|
|
case "HARD":
|
|
|
|
"difHard";
|
|
|
|
case _:
|
|
|
|
"difNormal";
|
|
|
|
}
|
|
|
|
|
|
|
|
difficulty.loadGraphic(Paths.image("resultScreen/" + diffSpr));
|
|
|
|
difficulty.y = -difficulty.height;
|
|
|
|
FlxTween.tween(difficulty, {y: 110}, 0.5, {ease: FlxEase.quartOut, startDelay: 0.8});
|
|
|
|
add(difficulty);
|
|
|
|
|
2022-09-21 22:00:43 +00:00
|
|
|
var blackTopBar:FlxSprite = new FlxSprite().loadGraphic(Paths.image("resultScreen/topBarBlack"));
|
|
|
|
blackTopBar.y = -blackTopBar.height;
|
|
|
|
FlxTween.tween(blackTopBar, {y: 0}, 0.4, {ease: FlxEase.quartOut, startDelay: 0.5});
|
|
|
|
add(blackTopBar);
|
|
|
|
|
2022-09-22 01:03:31 +00:00
|
|
|
var resultsAnim:FlxSprite = new FlxSprite(-2000, -10);
|
2022-09-21 22:00:43 +00:00
|
|
|
resultsAnim.frames = Paths.getSparrowAtlas("resultScreen/results");
|
|
|
|
resultsAnim.animation.addByPrefix("result", "results", 24, false);
|
|
|
|
resultsAnim.animation.play("result");
|
|
|
|
add(resultsAnim);
|
|
|
|
|
2022-09-22 00:26:16 +00:00
|
|
|
var ratingsPopin:FlxSprite = new FlxSprite(-150, 120);
|
2022-09-21 22:00:43 +00:00
|
|
|
ratingsPopin.frames = Paths.getSparrowAtlas("resultScreen/ratingsPopin");
|
|
|
|
ratingsPopin.animation.addByPrefix("idle", "Categories", 24, false);
|
|
|
|
// ratingsPopin.animation.play("idle");
|
|
|
|
ratingsPopin.visible = false;
|
|
|
|
add(ratingsPopin);
|
|
|
|
|
|
|
|
new FlxTimer().start(0.5, _ ->
|
|
|
|
{
|
|
|
|
ratingsPopin.animation.play("idle");
|
|
|
|
ratingsPopin.visible = true;
|
|
|
|
});
|
2022-09-20 06:16:12 +00:00
|
|
|
|
|
|
|
super.create();
|
|
|
|
}
|
|
|
|
|
|
|
|
override function update(elapsed:Float)
|
|
|
|
{
|
|
|
|
if (controls.PAUSE)
|
|
|
|
FlxG.switchState(new FreeplayState());
|
|
|
|
|
|
|
|
super.update(elapsed);
|
|
|
|
}
|
|
|
|
}
|
2022-09-20 17:18:40 +00:00
|
|
|
|
|
|
|
enum abstract ResultVariations(String)
|
|
|
|
{
|
|
|
|
var PERFECT;
|
|
|
|
var NORMAL;
|
|
|
|
var SHIT;
|
|
|
|
}
|