This commit is contained in:
Kolo 2024-10-10 19:21:51 +02:00 committed by GitHub
parent f61789e453
commit 3c25c7c6a9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 40 additions and 32 deletions

View file

@ -19,6 +19,8 @@ class ResultScore extends FlxTypedSpriteGroup<ScoreNum>
var dumbNumb = Std.parseInt(Std.string(val));
var prevNum:ScoreNum;
dumbNumb = Std.int(Math.min(dumbNumb, Math.pow(10, group.members.length) - 1));
while (dumbNumb > 0)
{
scoreStart += 1;
@ -50,12 +52,12 @@ class ResultScore extends FlxTypedSpriteGroup<ScoreNum>
public function animateNumbers():Void
{
for (i in group.members.length-scoreStart...group.members.length)
for (i in group.members.length - scoreStart...group.members.length)
{
// if(i.finalDigit == 10) continue;
// if(i.finalDigit == 10) continue;
new FlxTimer().start((i-1)/24, _ -> {
group.members[i].finalDelay = scoreStart - (i-1);
new FlxTimer().start((i - 1) / 24, _ -> {
group.members[i].finalDelay = scoreStart - (i - 1);
group.members[i].playAnim();
group.members[i].shuffle();
});
@ -97,10 +99,13 @@ class ScoreNum extends FlxSprite
{
if (val >= 0 && animation.curAnim != null && animation.curAnim.name != numToString[val])
{
if(glow){
if (glow)
{
animation.play(numToString[val], true, false, 0);
glow = false;
}else{
}
else
{
animation.play(numToString[val], true, false, 4);
}
updateHitbox();
@ -108,18 +113,18 @@ class ScoreNum extends FlxSprite
switch (val)
{
case 1:
// offset.x -= 15;
// offset.x -= 15;
case 5:
// set offsets
// offset.x += 0;
// offset.y += 10;
// set offsets
// offset.x += 0;
// offset.y += 10;
case 7:
// offset.y += 6;
// offset.y += 6;
case 4:
// offset.y += 5;
// offset.y += 5;
case 9:
// offset.y += 5;
// offset.y += 5;
default:
centerOffsets(false);
}
@ -144,44 +149,45 @@ class ScoreNum extends FlxSprite
"ZERO", "ONE", "TWO", "THREE", "FOUR", "FIVE", "SIX", "SEVEN", "EIGHT", "NINE", "DISABLED"
];
function finishShuffleTween():Void{
function finishShuffleTween():Void
{
var tweenFunction = function(x) {
var digitRounded = Math.floor(x);
//if(digitRounded == finalDigit) glow = true;
// if(digitRounded == finalDigit) glow = true;
digit = digitRounded;
};
finalTween = FlxTween.num(0.0, finalDigit, 23/24, {
ease: FlxEase.quadOut,
onComplete: function (input) {
new FlxTimer().start((finalDelay)/24, _ -> {
animation.play(animation.curAnim.name, true, false, 0);
});
// fuck
}
}, tweenFunction);
finalTween = FlxTween.num(0.0, finalDigit, 23 / 24,
{
ease: FlxEase.quadOut,
onComplete: function(input) {
new FlxTimer().start((finalDelay) / 24, _ -> {
animation.play(animation.curAnim.name, true, false, 0);
});
// fuck
}
}, tweenFunction);
}
function shuffleProgress(shuffleTimer:FlxTimer):Void
{
var tempDigit:Int = digit;
tempDigit += 1;
if(tempDigit > 9) tempDigit = 0;
if(tempDigit < 0) tempDigit = 0;
if (tempDigit > 9) tempDigit = 0;
if (tempDigit < 0) tempDigit = 0;
digit = tempDigit;
if (shuffleTimer.loops > 0 && shuffleTimer.loopsLeft == 0)
{
//digit = finalDigit;
// digit = finalDigit;
finishShuffleTween();
}
}
public function shuffle():Void{
var duration:Float = 41/24;
var interval:Float = 1/24;
public function shuffle():Void
{
var duration:Float = 41 / 24;
var interval:Float = 1 / 24;
shuffleTimer = new FlxTimer().start(interval, shuffleProgress, Std.int(duration / interval));
}

View file

@ -14,6 +14,8 @@ class FreeplayScore extends FlxTypedSpriteGroup<ScoreNum>
var dumbNumb = Std.parseInt(Std.string(val));
var prevNum:ScoreNum;
dumbNumb = Std.int(Math.min(dumbNumb, Math.pow(10, group.members.length) - 1));
while (dumbNumb > 0)
{
group.members[loopNum].digit = dumbNumb % 10;