2023-11-07 04:04:22 -05:00
|
|
|
package funkin.play.components;
|
2022-02-16 16:31:20 -05:00
|
|
|
|
|
|
|
import flixel.FlxSprite;
|
|
|
|
import flixel.group.FlxGroup.FlxTypedGroup;
|
|
|
|
import flixel.tweens.FlxTween;
|
2022-03-08 03:13:53 -05:00
|
|
|
import funkin.play.PlayState;
|
2022-02-16 16:31:20 -05:00
|
|
|
|
|
|
|
class PopUpStuff extends FlxTypedGroup<FlxSprite>
|
|
|
|
{
|
2023-01-22 22:25:45 -05:00
|
|
|
override public function new()
|
|
|
|
{
|
|
|
|
super();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function displayRating(daRating:String)
|
|
|
|
{
|
|
|
|
if (daRating == null) daRating = "good";
|
|
|
|
|
|
|
|
var rating:FlxSprite = new FlxSprite(0, 0);
|
|
|
|
rating.scrollFactor.set(0.2, 0.2);
|
|
|
|
|
|
|
|
rating.zIndex = 1000;
|
|
|
|
var ratingPath:String = daRating;
|
|
|
|
|
|
|
|
if (PlayState.instance.currentStageId.startsWith('school')) ratingPath = "weeb/pixelUI/" + ratingPath + "-pixel";
|
|
|
|
|
|
|
|
rating.loadGraphic(Paths.image(ratingPath));
|
|
|
|
rating.x = FlxG.width * 0.50;
|
|
|
|
rating.x -= FlxG.camera.scroll.x * 0.2;
|
|
|
|
// make sure rating is visible lol!
|
|
|
|
// if (rating.x < FlxG.camera.scroll.x)
|
|
|
|
// rating.x = FlxG.camera.scroll.x;
|
|
|
|
// else if (rating.x > FlxG.camera.scroll.x + FlxG.camera.width - rating.width)
|
|
|
|
// rating.x = FlxG.camera.scroll.x + FlxG.camera.width - rating.width;
|
|
|
|
|
|
|
|
// FlxG.camera.scroll.y +
|
|
|
|
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));
|
2023-06-25 12:36:00 -04:00
|
|
|
rating.antialiasing = false;
|
2023-01-22 22:25:45 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
rating.setGraphicSize(Std.int(rating.width * 0.7));
|
|
|
|
rating.antialiasing = true;
|
|
|
|
}
|
|
|
|
rating.updateHitbox();
|
|
|
|
|
|
|
|
FlxTween.tween(rating, {alpha: 0}, 0.2,
|
|
|
|
{
|
2023-06-08 16:30:45 -04:00
|
|
|
onComplete: function(tween:FlxTween) {
|
2023-01-22 22:25:45 -05:00
|
|
|
remove(rating, true);
|
|
|
|
rating.destroy();
|
|
|
|
},
|
2023-06-15 00:15:57 -04:00
|
|
|
startDelay: Conductor.beatLengthMs * 0.001
|
2023-01-22 22:25:45 -05:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
public function displayCombo(?combo:Int = 0):Int
|
|
|
|
{
|
|
|
|
if (combo == null) combo = 0;
|
|
|
|
|
|
|
|
var pixelShitPart1:String = "";
|
|
|
|
var pixelShitPart2:String = '';
|
|
|
|
|
|
|
|
if (PlayState.instance.currentStageId.startsWith('school'))
|
|
|
|
{
|
|
|
|
pixelShitPart1 = 'weeb/pixelUI/';
|
|
|
|
pixelShitPart2 = '-pixel';
|
|
|
|
}
|
|
|
|
var comboSpr:FlxSprite = new FlxSprite().loadGraphic(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;
|
|
|
|
// make sure combo is visible lol!
|
|
|
|
// 194 fits 4 combo digits
|
|
|
|
// if (comboSpr.x < FlxG.camera.scroll.x + 194)
|
|
|
|
// comboSpr.x = FlxG.camera.scroll.x + 194;
|
|
|
|
// else if (comboSpr.x > FlxG.camera.scroll.x + FlxG.camera.width - comboSpr.width)
|
|
|
|
// comboSpr.x = FlxG.camera.scroll.x + FlxG.camera.width - comboSpr.width;
|
|
|
|
|
|
|
|
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));
|
2023-06-25 12:36:00 -04:00
|
|
|
comboSpr.antialiasing = false;
|
2023-01-22 22:25:45 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
comboSpr.setGraphicSize(Std.int(comboSpr.width * 0.7));
|
|
|
|
comboSpr.antialiasing = true;
|
|
|
|
}
|
|
|
|
comboSpr.updateHitbox();
|
|
|
|
|
|
|
|
FlxTween.tween(comboSpr, {alpha: 0}, 0.2,
|
|
|
|
{
|
2023-06-08 16:30:45 -04:00
|
|
|
onComplete: function(tween:FlxTween) {
|
2023-01-22 22:25:45 -05:00
|
|
|
remove(comboSpr, true);
|
|
|
|
comboSpr.destroy();
|
|
|
|
},
|
2023-06-15 00:15:57 -04:00
|
|
|
startDelay: Conductor.beatLengthMs * 0.001
|
2023-01-22 22:25:45 -05:00
|
|
|
});
|
|
|
|
|
|
|
|
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:FlxSprite = new FlxSprite().loadGraphic(Paths.image(pixelShitPart1 + 'num' + Std.int(i) + pixelShitPart2));
|
|
|
|
numScore.y = comboSpr.y;
|
|
|
|
|
|
|
|
if (PlayState.instance.currentStageId.startsWith('school'))
|
|
|
|
{
|
|
|
|
numScore.setGraphicSize(Std.int(numScore.width * Constants.PIXEL_ART_SCALE));
|
2023-06-25 12:36:00 -04:00
|
|
|
numScore.antialiasing = false;
|
2023-01-22 22:25:45 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
numScore.setGraphicSize(Std.int(numScore.width * 0.5));
|
2023-06-25 12:36:00 -04:00
|
|
|
numScore.antialiasing = true;
|
2023-01-22 22:25:45 -05:00
|
|
|
}
|
|
|
|
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,
|
|
|
|
{
|
2023-06-08 16:30:45 -04:00
|
|
|
onComplete: function(tween:FlxTween) {
|
2023-01-22 22:25:45 -05:00
|
|
|
remove(numScore, true);
|
|
|
|
numScore.destroy();
|
|
|
|
},
|
2023-06-15 00:15:57 -04:00
|
|
|
startDelay: Conductor.beatLengthMs * 0.002
|
2023-01-22 22:25:45 -05:00
|
|
|
});
|
|
|
|
|
|
|
|
daLoop++;
|
|
|
|
}
|
|
|
|
|
|
|
|
return combo;
|
|
|
|
}
|
2022-02-16 16:31:20 -05:00
|
|
|
}
|