From 5c14a5e5e3203318db863f955cf009ff886cbaf0 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Mon, 6 Dec 2021 00:41:10 -0500 Subject: [PATCH] cool funny light --- source/FreeplayState.hx | 12 +++++--- source/freeplayStuff/FreeplayScore.hx | 43 ++++++++++++++++++++++----- 2 files changed, 43 insertions(+), 12 deletions(-) diff --git a/source/FreeplayState.hx b/source/FreeplayState.hx index 84e4011b3..0d6b717a1 100644 --- a/source/FreeplayState.hx +++ b/source/FreeplayState.hx @@ -222,7 +222,7 @@ class FreeplayState extends MusicBeatSubstate { fnfFreeplay.visible = true; fp.visible = true; - fp.updateScore(0); + fp.updateScore(FlxG.random.int(0, 1000)); new FlxTimer().start(1.5 / 24, function(bold) { @@ -388,6 +388,8 @@ class FreeplayState extends MusicBeatSubstate lerpScore = CoolUtil.coolLerp(lerpScore, intendedScore, 0.4); + fp.scoreShit = Std.int(lerpScore); + scoreText.text = "PERSONAL BEST:" + Math.round(lerpScore); positionHighscore(); @@ -566,7 +568,8 @@ class FreeplayState extends MusicBeatSubstate if (curDifficulty > 2) curDifficulty = 0; - intendedScore = Highscore.getScore(songs[curSelected].songName, curDifficulty); + // intendedScore = Highscore.getScore(songs[curSelected].songName, curDifficulty); + intendedScore = FlxG.random.int(0, 100000); PlayState.storyDifficulty = curDifficulty; @@ -589,7 +592,7 @@ class FreeplayState extends MusicBeatSubstate function changeSelection(change:Int = 0) { - fp.updateScore(0); + // fp.updateScore(12345); NGio.logEvent('Fresh'); @@ -605,7 +608,8 @@ class FreeplayState extends MusicBeatSubstate // selector.y = (70 * curSelected) + 30; - intendedScore = Highscore.getScore(songs[curSelected].songName, curDifficulty); + // intendedScore = Highscore.getScore(songs[curSelected].songName, curDifficulty); + intendedScore = FlxG.random.int(0, 1000000); // lerpScore = 0; #if PRELOAD_ALL diff --git a/source/freeplayStuff/FreeplayScore.hx b/source/freeplayStuff/FreeplayScore.hx index 2e3b8dae5..ccaa340ad 100644 --- a/source/freeplayStuff/FreeplayScore.hx +++ b/source/freeplayStuff/FreeplayScore.hx @@ -3,28 +3,52 @@ package freeplayStuff; import flixel.FlxSprite; import flixel.group.FlxSpriteGroup.FlxTypedSpriteGroup; +using StringTools; + class FreeplayScore extends FlxTypedSpriteGroup { - public var scoreShit:Int = 0; + public var scoreShit(default, set):Int = 0; + + function set_scoreShit(val):Int + { + var loopNum:Int = group.members.length - 1; + var dumbNumb = Std.parseInt(Std.string(val)); + + while (dumbNumb > 0) + { + trace(dumbNumb); + group.members[loopNum].digit = dumbNumb % 10; + + dumbNumb = Math.floor(dumbNumb / 10); + loopNum--; + } + + while (loopNum > 0) + { + group.members[loopNum].digit = 0; + loopNum--; + } + + trace(val); + + return val; + } public function new(x:Float, y:Float, scoreShit:Int = 100) { super(x, y); - this.scoreShit = scoreShit; - for (i in 0...7) { add(new ScoreNum(x + (45 * i), y, 0)); } + + this.scoreShit = scoreShit; } public function updateScore(scoreNew:Int) { - forEach(function(numScore) - { - numScore.digit = 8; - }); + scoreShit = scoreNew; } } @@ -34,7 +58,10 @@ class ScoreNum extends FlxSprite function set_digit(val):Int { - animation.play(Std.string(FlxG.random.int(0, 9)), true, false, 0); + if (animation.curAnim != null && animation.curAnim.name != Std.string(val)) + { + animation.play(Std.string(val), true, false, 0); + } return val; }