combo counter fixes & tweaks

This commit is contained in:
MtH 2021-04-20 20:38:07 +02:00
parent 5aefe519e0
commit 788c4e6f1b

View file

@ -2331,7 +2331,11 @@ class PlayState extends MusicBeatState
{
if (combo > 5 && gf.animOffsets.exists('sad'))
gf.playAnim('sad');
combo = 0;
if (combo != 0)
{
combo = 0;
displayCombo();
}
}
function endSong():Void
@ -2431,19 +2435,13 @@ class PlayState extends MusicBeatState
}
}
// gives score and pops up rating
private function popUpScore(strumtime:Float, daNote:Note):Void
{
var noteDiff:Float = Math.abs(strumtime - Conductor.songPosition);
// boyfriend.playAnim('hey');
vocals.volume = 1;
var placement:String = Std.string(combo);
var coolText:FlxText = new FlxText(0, 0, 0, placement, 32);
coolText.screenCenter();
coolText.x = FlxG.width * 0.55;
//
var rating:FlxSprite = new FlxSprite();
var score:Int = 350;
@ -2490,6 +2488,45 @@ class PlayState extends MusicBeatState
daRating = 'bad';
*/
var ratingPath:String = daRating;
if (curStage.startsWith('school'))
ratingPath = "weeb/pixelUI/" + ratingPath + "-pixel";
rating.loadGraphic(Paths.image(ratingPath));
rating.screenCenter();
rating.x = FlxG.width * 0.55 - 40;
rating.y -= 60;
rating.acceleration.y = 550;
rating.velocity.y -= FlxG.random.int(140, 175);
rating.velocity.x -= FlxG.random.int(0, 10);
add(rating);
if (curStage.startsWith('school'))
{
rating.setGraphicSize(Std.int(rating.width * daPixelZoom * 0.7));
}
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)
{
rating.destroy();
},
startDelay: Conductor.crochet * 0.001
});
if (combo >= 10 || combo == 0)
displayCombo();
}
function displayCombo():Void
{
var pixelShitPart1:String = "";
var pixelShitPart2:String = '';
@ -2499,70 +2536,71 @@ class PlayState extends MusicBeatState
pixelShitPart2 = '-pixel';
}
rating.loadGraphic(Paths.image(pixelShitPart1 + daRating + pixelShitPart2));
rating.screenCenter();
rating.x = coolText.x - 40;
rating.y -= 60;
rating.acceleration.y = 550;
rating.velocity.y -= FlxG.random.int(140, 175);
rating.velocity.x -= FlxG.random.int(0, 10);
var comboSpr:FlxSprite = new FlxSprite().loadGraphic(Paths.image(pixelShitPart1 + 'combo' + pixelShitPart2));
comboSpr.screenCenter();
comboSpr.x = coolText.x;
comboSpr.x = FlxG.width * 0.55;
comboSpr.y += 80;
comboSpr.acceleration.y = 600;
comboSpr.velocity.y -= 150;
comboSpr.velocity.x += FlxG.random.int(1, 10);
add(rating);
if (!curStage.startsWith('school'))
add(comboSpr);
if (curStage.startsWith('school'))
{
rating.setGraphicSize(Std.int(rating.width * 0.7));
rating.antialiasing = true;
comboSpr.setGraphicSize(Std.int(comboSpr.width * 0.7));
comboSpr.antialiasing = true;
comboSpr.setGraphicSize(Std.int(comboSpr.width * daPixelZoom * 0.7));
}
else
{
rating.setGraphicSize(Std.int(rating.width * daPixelZoom * 0.7));
comboSpr.setGraphicSize(Std.int(comboSpr.width * daPixelZoom * 0.7));
comboSpr.setGraphicSize(Std.int(comboSpr.width * 0.7));
comboSpr.antialiasing = true;
}
comboSpr.updateHitbox();
rating.updateHitbox();
FlxTween.tween(comboSpr, {alpha: 0}, 0.2, {
onComplete: function(tween:FlxTween)
{
comboSpr.destroy();
},
startDelay: Conductor.crochet * 0.001
});
var seperatedScore:Array<Int> = [];
var tempCombo:Int = combo;
seperatedScore.push(Math.floor(combo / 100));
seperatedScore.push(Math.floor((combo - (seperatedScore[0] * 100)) / 10));
seperatedScore.push(combo % 10);
while (tempCombo != 0)
{
seperatedScore.push(tempCombo % 10);
tempCombo = Std.int(tempCombo / 10);
}
while (seperatedScore.length < 3)
seperatedScore.push(0);
var daLoop:Int = 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.screenCenter();
numScore.x = coolText.x + (43 * daLoop) - 90;
numScore.y += 80;
numScore.y = comboSpr.y;
if (!curStage.startsWith('school'))
if (curStage.startsWith('school'))
{
numScore.setGraphicSize(Std.int(numScore.width * daPixelZoom));
}
else
{
numScore.antialiasing = true;
numScore.setGraphicSize(Std.int(numScore.width * 0.5));
}
else
{
numScore.setGraphicSize(Std.int(numScore.width * daPixelZoom));
}
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);
if (combo >= 10 || combo == 0)
add(numScore);
add(numScore);
FlxTween.tween(numScore, {alpha: 0}, 0.2, {
onComplete: function(tween:FlxTween)
@ -2574,30 +2612,6 @@ class PlayState extends MusicBeatState
daLoop++;
}
/*
trace(combo);
trace(seperatedScore);
*/
coolText.text = Std.string(seperatedScore);
// add(coolText);
FlxTween.tween(rating, {alpha: 0}, 0.2, {
startDelay: Conductor.crochet * 0.001
});
FlxTween.tween(comboSpr, {alpha: 0}, 0.2, {
onComplete: function(tween:FlxTween)
{
coolText.destroy();
comboSpr.destroy();
rating.destroy();
},
startDelay: Conductor.crochet * 0.001
});
curSection += 1;
}
var cameraRightSide:Bool = false;
@ -2837,8 +2851,8 @@ class PlayState extends MusicBeatState
{
if (!note.isSustainNote)
{
popUpScore(note.strumTime, note);
combo += 1;
popUpScore(note.strumTime, note);
}
if (note.noteData >= 0)