mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2024-11-05 14:24:28 +00:00
0a19c7a8cb
* hx the codec * fix(ci,html5): use haxe.Timer instead of Sys.time * refactor(compat): use haxe.Timer instead of Sys.time(), introduce TimerUtil to reduce code dupe * fix: redundant types * refactor(style): use TimerTools in place of haxe.Timer * refactor: consistent timer code * feat: build timings * refactor(ci): cleanup ci configs * sigh * sigh, 2 * fix: haxelib deleterepo does not silently fail * retrigger ci * verbose output * debug info after haxelib gti * force haxelib git override * more debug info * force bash * at least haxelib is consistent now * fix the runners first, then do that * update ci-haxe * it is time? * deleterepo may fail * finishing touches
165 lines
4.5 KiB
Haxe
165 lines
4.5 KiB
Haxe
package funkin.play.components;
|
|
|
|
import flixel.FlxSprite;
|
|
import flixel.group.FlxGroup.FlxTypedGroup;
|
|
import flixel.tweens.FlxTween;
|
|
import flixel.util.FlxDirection;
|
|
import funkin.graphics.FunkinSprite;
|
|
import funkin.play.PlayState;
|
|
import funkin.util.tools.TimerTools;
|
|
|
|
class PopUpStuff extends FlxTypedGroup<FlxSprite>
|
|
{
|
|
override public function new()
|
|
{
|
|
super();
|
|
}
|
|
|
|
public function displayRating(daRating:String)
|
|
{
|
|
var perfStart:Float = TimerTools.start();
|
|
|
|
if (daRating == null) daRating = "good";
|
|
|
|
var ratingPath:String = daRating;
|
|
|
|
if (PlayState.instance.currentStageId.startsWith('school')) ratingPath = "weeb/pixelUI/" + ratingPath + "-pixel";
|
|
|
|
var rating:FunkinSprite = FunkinSprite.create(0, 0, Paths.image(ratingPath));
|
|
rating.scrollFactor.set(0.2, 0.2);
|
|
|
|
rating.zIndex = 1000;
|
|
rating.x = FlxG.width * 0.50;
|
|
// rating.x -= FlxG.camera.scroll.x * 0.2;
|
|
rating.y = FlxG.camera.height * 0.4 - 60;
|
|
rating.acceleration.y = 550;
|
|
rating.velocity.y -= FlxG.random.int(140, 175);
|
|
rating.velocity.x -= FlxG.random.int(0, 10);
|
|
|
|
add(rating);
|
|
|
|
if (PlayState.instance.currentStageId.startsWith('school'))
|
|
{
|
|
rating.setGraphicSize(Std.int(rating.width * Constants.PIXEL_ART_SCALE * 0.7));
|
|
rating.antialiasing = false;
|
|
}
|
|
else
|
|
{
|
|
rating.setGraphicSize(Std.int(rating.width * 0.7));
|
|
rating.antialiasing = true;
|
|
}
|
|
rating.updateHitbox();
|
|
|
|
FlxTween.tween(rating, {alpha: 0}, 0.2,
|
|
{
|
|
onComplete: function(tween:FlxTween) {
|
|
remove(rating, true);
|
|
rating.destroy();
|
|
},
|
|
startDelay: Conductor.instance.beatLengthMs * 0.001
|
|
});
|
|
|
|
trace('displayRating took: ${TimerTools.seconds(perfStart)}');
|
|
}
|
|
|
|
public function displayCombo(?combo:Int = 0):Int
|
|
{
|
|
var perfStart:Float = TimerTools.start();
|
|
|
|
if (combo == null) combo = 0;
|
|
|
|
var pixelShitPart1:String = "";
|
|
var pixelShitPart2:String = '';
|
|
|
|
if (PlayState.instance.currentStageId.startsWith('school'))
|
|
{
|
|
pixelShitPart1 = 'weeb/pixelUI/';
|
|
pixelShitPart2 = '-pixel';
|
|
}
|
|
var comboSpr:FunkinSprite = FunkinSprite.create(Paths.image(pixelShitPart1 + 'combo' + pixelShitPart2));
|
|
comboSpr.y = FlxG.camera.height * 0.4 + 80;
|
|
comboSpr.x = FlxG.width * 0.50;
|
|
// comboSpr.x -= FlxG.camera.scroll.x * 0.2;
|
|
|
|
comboSpr.acceleration.y = 600;
|
|
comboSpr.velocity.y -= 150;
|
|
comboSpr.velocity.x += FlxG.random.int(1, 10);
|
|
|
|
add(comboSpr);
|
|
|
|
if (PlayState.instance.currentStageId.startsWith('school'))
|
|
{
|
|
comboSpr.setGraphicSize(Std.int(comboSpr.width * Constants.PIXEL_ART_SCALE * 0.7));
|
|
comboSpr.antialiasing = false;
|
|
}
|
|
else
|
|
{
|
|
comboSpr.setGraphicSize(Std.int(comboSpr.width * 0.7));
|
|
comboSpr.antialiasing = true;
|
|
}
|
|
comboSpr.updateHitbox();
|
|
|
|
FlxTween.tween(comboSpr, {alpha: 0}, 0.2,
|
|
{
|
|
onComplete: function(tween:FlxTween) {
|
|
remove(comboSpr, true);
|
|
comboSpr.destroy();
|
|
},
|
|
startDelay: Conductor.instance.beatLengthMs * 0.001
|
|
});
|
|
|
|
var seperatedScore:Array<Int> = [];
|
|
var tempCombo:Int = combo;
|
|
|
|
while (tempCombo != 0)
|
|
{
|
|
seperatedScore.push(tempCombo % 10);
|
|
tempCombo = Std.int(tempCombo / 10);
|
|
}
|
|
while (seperatedScore.length < 3)
|
|
seperatedScore.push(0);
|
|
|
|
// seperatedScore.reverse();
|
|
|
|
var daLoop:Int = 1;
|
|
for (i in seperatedScore)
|
|
{
|
|
var numScore:FunkinSprite = FunkinSprite.create(0, comboSpr.y, Paths.image(pixelShitPart1 + 'num' + Std.int(i) + pixelShitPart2));
|
|
|
|
if (PlayState.instance.currentStageId.startsWith('school'))
|
|
{
|
|
numScore.setGraphicSize(Std.int(numScore.width * Constants.PIXEL_ART_SCALE));
|
|
numScore.antialiasing = false;
|
|
}
|
|
else
|
|
{
|
|
numScore.setGraphicSize(Std.int(numScore.width * 0.5));
|
|
numScore.antialiasing = true;
|
|
}
|
|
numScore.updateHitbox();
|
|
|
|
numScore.x = comboSpr.x - (43 * daLoop); //- 90;
|
|
numScore.acceleration.y = FlxG.random.int(200, 300);
|
|
numScore.velocity.y -= FlxG.random.int(140, 160);
|
|
numScore.velocity.x = FlxG.random.float(-5, 5);
|
|
|
|
add(numScore);
|
|
|
|
FlxTween.tween(numScore, {alpha: 0}, 0.2,
|
|
{
|
|
onComplete: function(tween:FlxTween) {
|
|
remove(numScore, true);
|
|
numScore.destroy();
|
|
},
|
|
startDelay: Conductor.instance.beatLengthMs * 0.002
|
|
});
|
|
|
|
daLoop++;
|
|
}
|
|
|
|
trace('displayCombo took: ${TimerTools.seconds(perfStart)}');
|
|
|
|
return combo;
|
|
}
|
|
}
|