mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2024-12-23 05:37:38 +00:00
Reimplement rank-based results animations.
This commit is contained in:
parent
a243b167b2
commit
5d5cf74020
|
@ -23,7 +23,7 @@ Please check out our [Contributor's guide](./CONTRIBUTORS.md) on how you can act
|
|||
|
||||
## Programming
|
||||
- [ninjamuffin99](https://twitter.com/ninja_muffin99) - Lead Programmer
|
||||
- [MasterEric](https://twitter.com/EliteMasterEric) - Programmer
|
||||
- [EliteMasterEric](https://twitter.com/EliteMasterEric) - Programmer
|
||||
- [MtH](https://twitter.com/emmnyaa) - Charting and Additional Programming
|
||||
- [GeoKureli](https://twitter.com/Geokureli/) - Additional Programming
|
||||
- Our contributors on GitHub
|
||||
|
|
2
assets
2
assets
|
@ -1 +1 @@
|
|||
Subproject commit fe52d20de7025d90cadb429dbdedf6d986727088
|
||||
Subproject commit 6115eb6837e97b8b3ad82f3ccd2a49a4383ed35b
|
|
@ -26,6 +26,7 @@ import funkin.play.components.TallyCounter;
|
|||
/**
|
||||
* The state for the results screen after a song or week is finished.
|
||||
*/
|
||||
@:nullSafety
|
||||
class ResultState extends MusicBeatSubState
|
||||
{
|
||||
final params:ResultsStateParams;
|
||||
|
@ -42,91 +43,45 @@ class ResultState extends MusicBeatSubState
|
|||
super();
|
||||
|
||||
this.params = params;
|
||||
|
||||
resultsVariation = calculateVariation(params);
|
||||
|
||||
var fontLetters:String = "AaBbCcDdEeFfGgHhiIJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz:1234567890";
|
||||
songName = new FlxBitmapText(FlxBitmapFont.fromMonospace(Paths.image("resultScreen/tardlingSpritesheet"), fontLetters, FlxPoint.get(49, 62)));
|
||||
songName.text = params.title;
|
||||
songName.letterSpacing = -15;
|
||||
songName.angle = -4.4;
|
||||
songName.zIndex = 1000;
|
||||
|
||||
difficulty = new FlxSprite(555);
|
||||
difficulty.zIndex = 1000;
|
||||
}
|
||||
|
||||
override function create():Void
|
||||
{
|
||||
/*
|
||||
if (params.scoreData.sick == params.scoreData.totalNotesHit
|
||||
&& params.scoreData.maxCombo == params.scoreData.totalNotesHit) resultsVariation = PERFECT;
|
||||
else if (params.scoreData.missed + params.scoreData.bad + params.scoreData.shit >= params.scoreData.totalNotes * 0.50)
|
||||
resultsVariation = SHIT; // if more than half of your song was missed, bad, or shit notes, you get shit ending!
|
||||
else
|
||||
resultsVariation = NORMAL;
|
||||
*/
|
||||
resultsVariation = NORMAL;
|
||||
|
||||
FunkinSound.playMusic('results$resultsVariation',
|
||||
FunkinSound.playMusic(resultsVariation.getMusicPath(),
|
||||
{
|
||||
startingVolume: 1.0,
|
||||
overrideExisting: true,
|
||||
restartTrack: true,
|
||||
loop: resultsVariation != SHIT
|
||||
loop: resultsVariation.shouldMusicLoop()
|
||||
});
|
||||
|
||||
// Reset the camera zoom on the results screen.
|
||||
FlxG.camera.zoom = 1.0;
|
||||
|
||||
// TEMP-ish, just used to sorta "cache" the 3000x3000 image!
|
||||
var cacheBullShit:FlxSprite = new FlxSprite().loadGraphic(Paths.image("resultScreen/soundSystem"));
|
||||
add(cacheBullShit);
|
||||
|
||||
var dumb:FlxSprite = new FlxSprite().loadGraphic(Paths.image("resultScreen/scorePopin"));
|
||||
add(dumb);
|
||||
|
||||
var bg:FlxSprite = FlxGradient.createGradientFlxSprite(FlxG.width, FlxG.height, [0xFFFECC5C, 0xFFFDC05C], 90);
|
||||
bg.scrollFactor.set();
|
||||
bg.zIndex = 10;
|
||||
add(bg);
|
||||
|
||||
var bgFlash:FlxSprite = FlxGradient.createGradientFlxSprite(FlxG.width, FlxG.height, [0xFFFFEB69, 0xFFFFE66A], 90);
|
||||
bgFlash.scrollFactor.set();
|
||||
bgFlash.visible = false;
|
||||
bg.zIndex = 20;
|
||||
add(bgFlash);
|
||||
|
||||
// var bfGfExcellent:FlxAtlasSprite = new FlxAtlasSprite(380, -170, Paths.animateAtlas("resultScreen/resultsBoyfriendExcellent", "shared"));
|
||||
// bfGfExcellent.visible = false;
|
||||
// add(bfGfExcellent);
|
||||
//
|
||||
// var bfPerfect:FlxAtlasSprite = new FlxAtlasSprite(370, -180, Paths.animateAtlas("resultScreen/resultsBoyfriendPerfect", "shared"));
|
||||
// bfPerfect.visible = false;
|
||||
// add(bfPerfect);
|
||||
//
|
||||
// var bfSHIT:FlxAtlasSprite = new FlxAtlasSprite(0, 20, Paths.animateAtlas("resultScreen/resultsBoyfriendSHIT", "shared"));
|
||||
// bfSHIT.visible = false;
|
||||
// add(bfSHIT);
|
||||
//
|
||||
// bfGfExcellent.anim.onComplete = () -> {
|
||||
// bfGfExcellent.anim.curFrame = 28;
|
||||
// bfGfExcellent.anim.play(); // unpauses this anim, since it's on PlayOnce!
|
||||
// };
|
||||
//
|
||||
// bfPerfect.anim.onComplete = () -> {
|
||||
// bfPerfect.anim.curFrame = 136;
|
||||
// bfPerfect.anim.play(); // unpauses this anim, since it's on PlayOnce!
|
||||
// };
|
||||
//
|
||||
// bfSHIT.anim.onComplete = () -> {
|
||||
// bfSHIT.anim.curFrame = 150;
|
||||
// bfSHIT.anim.play(); // unpauses this anim, since it's on PlayOnce!
|
||||
// };
|
||||
|
||||
var gf:FlxSprite = FunkinSprite.createSparrow(625, 325, 'resultScreen/resultGirlfriendGOOD');
|
||||
gf.animation.addByPrefix("clap", "Girlfriend Good Anim", 24, false);
|
||||
gf.visible = false;
|
||||
gf.animation.finishCallback = _ -> {
|
||||
gf.animation.play('clap', true, false, 9);
|
||||
};
|
||||
add(gf);
|
||||
|
||||
var boyfriend:FlxSprite = FunkinSprite.createSparrow(640, -200, 'resultScreen/resultBoyfriendGOOD');
|
||||
boyfriend.animation.addByPrefix("fall", "Boyfriend Good Anim0", 24, false);
|
||||
boyfriend.visible = false;
|
||||
boyfriend.animation.finishCallback = function(_) {
|
||||
boyfriend.animation.play('fall', true, false, 14);
|
||||
};
|
||||
|
||||
add(boyfriend);
|
||||
|
||||
// The sound system which falls into place behind the score text. Plays every time!
|
||||
var soundSystem:FlxSprite = FunkinSprite.createSparrow(-15, -180, 'resultScreen/soundSystem');
|
||||
soundSystem.animation.addByPrefix("idle", "sound system", 24, false);
|
||||
soundSystem.visible = false;
|
||||
|
@ -134,9 +89,66 @@ class ResultState extends MusicBeatSubState
|
|||
soundSystem.animation.play("idle");
|
||||
soundSystem.visible = true;
|
||||
});
|
||||
soundSystem.zIndex = 1100;
|
||||
add(soundSystem);
|
||||
|
||||
difficulty = new FlxSprite(555);
|
||||
var bfPerfect:Null<FlxAtlasSprite> = null;
|
||||
var bfExcellent:Null<FlxAtlasSprite> = null;
|
||||
var bfGood:Null<FlxSprite> = null;
|
||||
var gfGood:Null<FlxSprite> = null;
|
||||
var bfShit:Null<FlxAtlasSprite> = null;
|
||||
|
||||
switch (resultsVariation)
|
||||
{
|
||||
case PERFECT | PERFECT_GOLD | PERFECT_PLATINUM:
|
||||
bfPerfect = new FlxAtlasSprite(370, -180, Paths.animateAtlas("resultScreen/results-bf/resultsPERFECT", "shared"));
|
||||
bfPerfect.visible = false;
|
||||
bfPerfect.zIndex = 500;
|
||||
add(bfPerfect);
|
||||
|
||||
bfPerfect.anim.onComplete = () -> {
|
||||
bfPerfect.anim.curFrame = 136;
|
||||
bfPerfect.anim.play(); // unpauses this anim, since it's on PlayOnce!
|
||||
};
|
||||
|
||||
case EXCELLENT:
|
||||
bfExcellent = new FlxAtlasSprite(380, -170, Paths.animateAtlas("resultScreen/results-bf/resultsEXCELLENT", "shared"));
|
||||
bfExcellent.visible = false;
|
||||
bfExcellent.zIndex = 500;
|
||||
add(bfExcellent);
|
||||
|
||||
bfExcellent.onAnimationFinish.add((animName) -> {
|
||||
bfExcellent.playAnimation('Loop Start');
|
||||
});
|
||||
|
||||
case GOOD | GREAT:
|
||||
gfGood = FunkinSprite.createSparrow(625, 325, 'resultScreen/results-bf/resultsGOOD/resultGirlfriendGOOD');
|
||||
gfGood.animation.addByPrefix("clap", "Girlfriend Good Anim", 24, false);
|
||||
gfGood.visible = false;
|
||||
gfGood.zIndex = 500;
|
||||
gfGood.animation.finishCallback = _ -> {
|
||||
gfGood.animation.play('clap', true, false, 9);
|
||||
};
|
||||
add(gfGood);
|
||||
|
||||
bfGood = FunkinSprite.createSparrow(640, -200, 'resultScreen/results-bf/resultsGOOD/resultBoyfriendGOOD');
|
||||
bfGood.animation.addByPrefix("fall", "Boyfriend Good Anim0", 24, false);
|
||||
bfGood.visible = false;
|
||||
bfGood.zIndex = 501;
|
||||
bfGood.animation.finishCallback = function(_) {
|
||||
bfGood.animation.play('fall', true, false, 14);
|
||||
};
|
||||
add(bfGood);
|
||||
|
||||
case SHIT:
|
||||
bfShit = new FlxAtlasSprite(0, 20, Paths.animateAtlas("resultScreen/results-bf/resultsSHIT", "shared"));
|
||||
bfShit.visible = false;
|
||||
bfShit.zIndex = 500;
|
||||
add(bfShit);
|
||||
bfShit.onAnimationFinish.add((animName) -> {
|
||||
bfShit.playAnimation('Loop Start');
|
||||
});
|
||||
}
|
||||
|
||||
var diffSpr:String = switch (PlayState.instance.currentDifficulty)
|
||||
{
|
||||
|
@ -157,11 +169,6 @@ class ResultState extends MusicBeatSubState
|
|||
difficulty.loadGraphic(Paths.image("resultScreen/" + diffSpr));
|
||||
add(difficulty);
|
||||
|
||||
var fontLetters:String = "AaBbCcDdEeFfGgHhiIJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz:1234567890";
|
||||
songName = new FlxBitmapText(FlxBitmapFont.fromMonospace(Paths.image("resultScreen/tardlingSpritesheet"), fontLetters, FlxPoint.get(49, 62)));
|
||||
songName.text = params.title;
|
||||
songName.letterSpacing = -15;
|
||||
songName.angle = -4.4;
|
||||
add(songName);
|
||||
|
||||
var angleRad = songName.angle * Math.PI / 180;
|
||||
|
@ -179,21 +186,25 @@ class ResultState extends MusicBeatSubState
|
|||
var blackTopBar:FlxSprite = new FlxSprite().loadGraphic(Paths.image("resultScreen/topBarBlack"));
|
||||
blackTopBar.y = -blackTopBar.height;
|
||||
FlxTween.tween(blackTopBar, {y: 0}, 0.4, {ease: FlxEase.quartOut, startDelay: 0.5});
|
||||
blackTopBar.zIndex = 1010;
|
||||
add(blackTopBar);
|
||||
|
||||
var resultsAnim:FunkinSprite = FunkinSprite.createSparrow(-200, -10, "resultScreen/results");
|
||||
resultsAnim.animation.addByPrefix("result", "results instance 1", 24, false);
|
||||
resultsAnim.animation.play("result");
|
||||
resultsAnim.zIndex = 1200;
|
||||
add(resultsAnim);
|
||||
|
||||
var ratingsPopin:FunkinSprite = FunkinSprite.createSparrow(-150, 120, "resultScreen/ratingsPopin");
|
||||
ratingsPopin.animation.addByPrefix("idle", "Categories", 24, false);
|
||||
ratingsPopin.visible = false;
|
||||
ratingsPopin.zIndex = 1200;
|
||||
add(ratingsPopin);
|
||||
|
||||
var scorePopin:FunkinSprite = FunkinSprite.createSparrow(-180, 520, "resultScreen/scorePopin");
|
||||
scorePopin.animation.addByPrefix("score", "tally score", 24, false);
|
||||
scorePopin.visible = false;
|
||||
scorePopin.zIndex = 1200;
|
||||
add(scorePopin);
|
||||
|
||||
var highscoreNew:FlxSprite = new FlxSprite(310, 570);
|
||||
|
@ -202,11 +213,13 @@ class ResultState extends MusicBeatSubState
|
|||
highscoreNew.visible = false;
|
||||
highscoreNew.setGraphicSize(Std.int(highscoreNew.width * 0.8));
|
||||
highscoreNew.updateHitbox();
|
||||
highscoreNew.zIndex = 1200;
|
||||
add(highscoreNew);
|
||||
|
||||
var hStuf:Int = 50;
|
||||
|
||||
var ratingGrp:FlxTypedGroup<TallyCounter> = new FlxTypedGroup<TallyCounter>();
|
||||
ratingGrp.zIndex = 1200;
|
||||
add(ratingGrp);
|
||||
|
||||
/**
|
||||
|
@ -238,6 +251,7 @@ class ResultState extends MusicBeatSubState
|
|||
|
||||
var score:ResultScore = new ResultScore(35, 305, 10, params.scoreData.score);
|
||||
score.visible = false;
|
||||
score.zIndex = 1200;
|
||||
add(score);
|
||||
|
||||
for (ind => rating in ratingGrp.members)
|
||||
|
@ -275,40 +289,72 @@ class ResultState extends MusicBeatSubState
|
|||
|
||||
switch (resultsVariation)
|
||||
{
|
||||
// case SHIT:
|
||||
// bfSHIT.visible = true;
|
||||
// bfSHIT.playAnimation("");
|
||||
case PERFECT | PERFECT_GOLD | PERFECT_PLATINUM:
|
||||
if (bfPerfect == null)
|
||||
{
|
||||
trace("Could not build PERFECT animation!");
|
||||
}
|
||||
else
|
||||
{
|
||||
bfPerfect.visible = true;
|
||||
bfPerfect.playAnimation('');
|
||||
}
|
||||
|
||||
case NORMAL:
|
||||
boyfriend.animation.play('fall');
|
||||
boyfriend.visible = true;
|
||||
case EXCELLENT:
|
||||
if (bfExcellent == null)
|
||||
{
|
||||
trace("Could not build EXCELLENT animation!");
|
||||
}
|
||||
else
|
||||
{
|
||||
bfExcellent.visible = true;
|
||||
bfExcellent.playAnimation('Intro');
|
||||
}
|
||||
|
||||
new FlxTimer().start((1 / 24) * 12, _ -> {
|
||||
bgFlash.visible = true;
|
||||
FlxTween.tween(bgFlash, {alpha: 0}, 0.4);
|
||||
new FlxTimer().start((1 / 24) * 2, _ ->
|
||||
{
|
||||
// bgFlash.alpha = 0.5;
|
||||
case SHIT:
|
||||
if (bfShit == null)
|
||||
{
|
||||
trace("Could not build SHIT animation!");
|
||||
}
|
||||
else
|
||||
{
|
||||
bfShit.visible = true;
|
||||
bfShit.playAnimation('Intro');
|
||||
}
|
||||
|
||||
// bgFlash.visible = false;
|
||||
});
|
||||
});
|
||||
case GREAT | GOOD:
|
||||
if (bfGood == null || gfGood == null)
|
||||
{
|
||||
trace("Could not build GOOD animation!");
|
||||
}
|
||||
else
|
||||
{
|
||||
bfGood.animation.play('fall');
|
||||
bfGood.visible = true;
|
||||
|
||||
new FlxTimer().start((1 / 24) * 22, _ -> {
|
||||
// plays about 22 frames (at 24fps timing) after bf spawns in
|
||||
gf.animation.play('clap', true);
|
||||
gf.visible = true;
|
||||
});
|
||||
// case PERFECT:
|
||||
// bfPerfect.visible = true;
|
||||
// bfPerfect.playAnimation("");
|
||||
new FlxTimer().start((1 / 24) * 12, _ -> {
|
||||
bgFlash.visible = true;
|
||||
FlxTween.tween(bgFlash, {alpha: 0}, 0.4);
|
||||
new FlxTimer().start((1 / 24) * 2, _ ->
|
||||
{
|
||||
// bgFlash.alpha = 0.5;
|
||||
|
||||
// bfGfExcellent.visible = true;
|
||||
// bfGfExcellent.playAnimation("");
|
||||
// bgFlash.visible = false;
|
||||
});
|
||||
});
|
||||
|
||||
new FlxTimer().start((1 / 24) * 22, _ -> {
|
||||
// plays about 22 frames (at 24fps timing) after bf spawns in
|
||||
gfGood.animation.play('clap', true);
|
||||
gfGood.visible = true;
|
||||
});
|
||||
}
|
||||
default:
|
||||
}
|
||||
});
|
||||
|
||||
refresh();
|
||||
|
||||
super.create();
|
||||
}
|
||||
|
||||
|
@ -401,14 +447,100 @@ class ResultState extends MusicBeatSubState
|
|||
|
||||
super.update(elapsed);
|
||||
}
|
||||
|
||||
public static function calculateVariation(params:ResultsStateParams):ResultVariations
|
||||
{
|
||||
// Perfect (Platinum) is a Sick Full Clear
|
||||
var isPerfectPlat = (params.scoreData.tallies.sick + params.scoreData.tallies.good) == params.scoreData.tallies.totalNotes
|
||||
&& params.scoreData.tallies.sick / params.scoreData.tallies.totalNotes >= Constants.RANK_PERFECT_PLAT_THRESHOLD;
|
||||
if (isPerfectPlat) return ResultVariations.PERFECT_PLATINUM;
|
||||
|
||||
// Perfect (Gold) is an 85% Sick Full Clear
|
||||
var isPerfectGold = (params.scoreData.tallies.sick + params.scoreData.tallies.good) == params.scoreData.tallies.totalNotes
|
||||
&& params.scoreData.tallies.sick / params.scoreData.tallies.totalNotes >= Constants.RANK_PERFECT_GOLD_THRESHOLD;
|
||||
if (isPerfectGold) return ResultVariations.PERFECT_GOLD;
|
||||
|
||||
// Else, use the standard grades
|
||||
|
||||
// Clear % (including bad and shit). 1.00 is a full clear but not a full combo
|
||||
var clear = (params.scoreData.tallies.totalNotesHit) / params.scoreData.tallies.totalNotes;
|
||||
|
||||
if (clear == Constants.RANK_PERFECT_THRESHOLD)
|
||||
{
|
||||
return ResultVariations.PERFECT;
|
||||
}
|
||||
else if (clear >= Constants.RANK_EXCELLENT_THRESHOLD)
|
||||
{
|
||||
return ResultVariations.EXCELLENT;
|
||||
}
|
||||
else if (clear >= Constants.RANK_GREAT_THRESHOLD)
|
||||
{
|
||||
return ResultVariations.GREAT;
|
||||
}
|
||||
else if (clear >= Constants.RANK_GOOD_THRESHOLD)
|
||||
{
|
||||
return ResultVariations.GOOD;
|
||||
}
|
||||
else
|
||||
{
|
||||
return ResultVariations.SHIT;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
enum abstract ResultVariations(String)
|
||||
{
|
||||
var PERFECT_PLATINUM;
|
||||
var PERFECT_GOLD;
|
||||
var PERFECT;
|
||||
var EXCELLENT;
|
||||
var NORMAL;
|
||||
var GREAT;
|
||||
var GOOD;
|
||||
var SHIT;
|
||||
|
||||
public function getMusicPath():String
|
||||
{
|
||||
switch (abstract)
|
||||
{
|
||||
case PERFECT_PLATINUM:
|
||||
return 'resultsPERFECT';
|
||||
case PERFECT_GOLD:
|
||||
return 'resultsPERFECT';
|
||||
case PERFECT:
|
||||
return 'resultsPERFECT';
|
||||
case EXCELLENT:
|
||||
return 'resultsNORMAL';
|
||||
case GREAT:
|
||||
return 'resultsNORMAL';
|
||||
case GOOD:
|
||||
return 'resultsNORMAL';
|
||||
case SHIT:
|
||||
return 'resultsSHIT';
|
||||
}
|
||||
}
|
||||
|
||||
public function shouldMusicLoop():Bool
|
||||
{
|
||||
switch (abstract)
|
||||
{
|
||||
case PERFECT_PLATINUM:
|
||||
return true;
|
||||
case PERFECT_GOLD:
|
||||
return true;
|
||||
case PERFECT:
|
||||
return true;
|
||||
case EXCELLENT:
|
||||
return true;
|
||||
case GREAT:
|
||||
return true;
|
||||
case GOOD:
|
||||
return true;
|
||||
case SHIT:
|
||||
return false;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
typedef ResultsStateParams =
|
||||
|
|
|
@ -455,6 +455,17 @@ class Constants
|
|||
public static final JUDGEMENT_BAD_COMBO_BREAK:Bool = true;
|
||||
public static final JUDGEMENT_SHIT_COMBO_BREAK:Bool = true;
|
||||
|
||||
// % Sick
|
||||
public static final RANK_PERFECT_PLAT_THRESHOLD:Float = 1.0; // % Sick
|
||||
public static final RANK_PERFECT_GOLD_THRESHOLD:Float = 0.85; // % Sick
|
||||
|
||||
// % Hit
|
||||
public static final RANK_PERFECT_THRESHOLD:Float = 1.00;
|
||||
public static final RANK_EXCELLENT_THRESHOLD:Float = 0.90;
|
||||
public static final RANK_GREAT_THRESHOLD:Float = 0.75;
|
||||
public static final RANK_GOOD_THRESHOLD:Float = 0.60;
|
||||
|
||||
// public static final RANK_SHIT_THRESHOLD:Float = 0.00;
|
||||
/**
|
||||
* FILE EXTENSIONS
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue