colors and numbers teehee

This commit is contained in:
Cameron Taylor 2022-09-22 04:09:06 -04:00
parent 8cd96a7b0d
commit 46c15e76f1
3 changed files with 137 additions and 6 deletions

View file

@ -1445,12 +1445,25 @@ class PlayState extends MusicBeatState implements IHook
trace('WENT TO RESULTS SCREEN!'); trace('WENT TO RESULTS SCREEN!');
// unloadAssets(); // unloadAssets();
persistentUpdate = false; camZooming = false;
vocals.stop(); FlxG.camera.follow(PlayState.instance.currentStage.getGirlfriend(), null, 0.05);
FlxG.camera.targetOffset.y -= 370;
var res:ResultState = new ResultState(); new FlxTimer().start(0.8, _ ->
res.camera = camHUD; {
openSubState(res); FlxTween.tween(FlxG.camera, {zoom: 1200}, 1.1, {
ease: FlxEase.expoIn,
onComplete: _ ->
{
persistentUpdate = false;
vocals.stop();
var res:ResultState = new ResultState();
res.camera = camHUD;
openSubState(res);
}
});
});
// FlxG.switchState(new FreeplayState()); // FlxG.switchState(new FreeplayState());
} }
} }

View file

@ -9,6 +9,7 @@ import flixel.tweens.FlxTween;
import flixel.util.FlxColor; import flixel.util.FlxColor;
import flixel.util.FlxGradient; import flixel.util.FlxGradient;
import flixel.util.FlxTimer; import flixel.util.FlxTimer;
import funkin.ui.TallyCounter;
class ResultState extends MusicBeatSubstate class ResultState extends MusicBeatSubstate
{ {
@ -42,6 +43,7 @@ class ResultState extends MusicBeatSubstate
soundSystem.animation.play("idle"); soundSystem.animation.play("idle");
soundSystem.visible = true; soundSystem.visible = true;
}); });
soundSystem.antialiasing = true;
add(soundSystem); add(soundSystem);
var difficulty:FlxSprite = new FlxSprite(680); var difficulty:FlxSprite = new FlxSprite(680);
@ -61,17 +63,20 @@ class ResultState extends MusicBeatSubstate
difficulty.loadGraphic(Paths.image("resultScreen/" + diffSpr)); difficulty.loadGraphic(Paths.image("resultScreen/" + diffSpr));
difficulty.y = -difficulty.height; difficulty.y = -difficulty.height;
FlxTween.tween(difficulty, {y: 110}, 0.5, {ease: FlxEase.quartOut, startDelay: 0.8}); FlxTween.tween(difficulty, {y: 110}, 0.5, {ease: FlxEase.quartOut, startDelay: 0.8});
difficulty.antialiasing = true;
add(difficulty); add(difficulty);
var blackTopBar:FlxSprite = new FlxSprite().loadGraphic(Paths.image("resultScreen/topBarBlack")); var blackTopBar:FlxSprite = new FlxSprite().loadGraphic(Paths.image("resultScreen/topBarBlack"));
blackTopBar.y = -blackTopBar.height; blackTopBar.y = -blackTopBar.height;
FlxTween.tween(blackTopBar, {y: 0}, 0.4, {ease: FlxEase.quartOut, startDelay: 0.5}); FlxTween.tween(blackTopBar, {y: 0}, 0.4, {ease: FlxEase.quartOut, startDelay: 0.5});
blackTopBar.antialiasing = true;
add(blackTopBar); add(blackTopBar);
var resultsAnim:FlxSprite = new FlxSprite(-2000, -10); var resultsAnim:FlxSprite = new FlxSprite(-200, -10);
resultsAnim.frames = Paths.getSparrowAtlas("resultScreen/results"); resultsAnim.frames = Paths.getSparrowAtlas("resultScreen/results");
resultsAnim.animation.addByPrefix("result", "results", 24, false); resultsAnim.animation.addByPrefix("result", "results", 24, false);
resultsAnim.animation.play("result"); resultsAnim.animation.play("result");
resultsAnim.antialiasing = true;
add(resultsAnim); add(resultsAnim);
var ratingsPopin:FlxSprite = new FlxSprite(-150, 120); var ratingsPopin:FlxSprite = new FlxSprite(-150, 120);
@ -79,8 +84,32 @@ class ResultState extends MusicBeatSubstate
ratingsPopin.animation.addByPrefix("idle", "Categories", 24, false); ratingsPopin.animation.addByPrefix("idle", "Categories", 24, false);
// ratingsPopin.animation.play("idle"); // ratingsPopin.animation.play("idle");
ratingsPopin.visible = false; ratingsPopin.visible = false;
ratingsPopin.antialiasing = true;
add(ratingsPopin); add(ratingsPopin);
var hStuf:Int = 50;
var totalHit:TallyCounter = new TallyCounter(375, hStuf * 3, Highscore.tallies.totalNotes);
add(totalHit);
var maxCombo:TallyCounter = new TallyCounter(375, hStuf * 4, Highscore.tallies.maxCombo);
add(maxCombo);
var tallySick:TallyCounter = new TallyCounter(230, hStuf * 5, Highscore.tallies.sick, 0xFF89E59E);
add(tallySick);
var tallyGood:TallyCounter = new TallyCounter(230, hStuf * 6, Highscore.tallies.good, 0xFF89C9E5);
add(tallyGood);
var tallyBad:TallyCounter = new TallyCounter(230, hStuf * 7, Highscore.tallies.bad, 0xffE6CF8A);
add(tallyBad);
var tallyShit:TallyCounter = new TallyCounter(230, hStuf * 8, Highscore.tallies.shit, 0xFFE68C8A);
add(tallyShit);
var tallyMissed:TallyCounter = new TallyCounter(230, hStuf * 9, Highscore.tallies.missed, 0xFFC68AE6);
add(tallyMissed);
new FlxTimer().start(0.5, _ -> new FlxTimer().start(0.5, _ ->
{ {
ratingsPopin.animation.play("idle"); ratingsPopin.animation.play("idle");

View file

@ -0,0 +1,89 @@
package funkin.ui;
import flixel.FlxSprite;
import flixel.group.FlxGroup.FlxTypedGroup;
import flixel.group.FlxSpriteGroup.FlxTypedSpriteGroup;
import flixel.math.FlxMath;
import flixel.tweens.FlxEase;
import flixel.tweens.FlxTween;
/**
* Similar to ComboCounter, but it's not!
*/
class TallyCounter extends FlxTypedSpriteGroup<FlxSprite>
{
var curNumber:Float = 0;
public var neededNumber:Int = 0;
public var flavour:Int = 0xFFFFFFFF;
public function new(x:Float, y:Float, neededNumber:Int = 0, ?flavour:Int = 0xFFFFFFFF)
{
super(x, y);
this.flavour = flavour;
this.neededNumber = neededNumber;
FlxTween.tween(this, {curNumber: neededNumber}, 4, {ease: FlxEase.quartOut});
drawNumbers();
}
var tmr:Float = 0;
override function update(elapsed:Float)
{
super.update(elapsed);
if (curNumber < neededNumber)
drawNumbers();
}
function drawNumbers()
{
var seperatedScore:Array<Int> = [];
var tempCombo:Int = Math.round(curNumber);
while (tempCombo != 0)
{
seperatedScore.push(tempCombo % 10);
tempCombo = Math.floor(tempCombo / 10);
}
if (seperatedScore.length == 0)
seperatedScore.push(0);
seperatedScore.reverse();
for (ind => num in seperatedScore)
{
if (ind >= members.length)
{
var numb:TallyNumber = new TallyNumber(ind * 43, 0, num);
add(numb);
numb.color = flavour;
}
else
{
members[ind].animation.play(Std.string(num));
members[ind].color = flavour;
}
}
}
}
class TallyNumber extends FlxSprite
{
public function new(x:Float, y:Float, digit:Int)
{
super(x, y);
frames = Paths.getSparrowAtlas("resultScreen/tallieNumber");
for (i in 0...10)
animation.addByPrefix(Std.string(i), i + " small", 24, false);
animation.play(Std.string(digit));
antialiasing = true;
updateHitbox();
}
}