Bring back Freeplay rank slamming animation
Another Freeplay fix caused by the same commit! Manually reverts changes from https://github.com/FunkinCrew/Funkin/commit/f7a48bcb3b9ab0f5393552b828b8687c6ae6926c where Cam converted the FreeplayRank class into a FlxSpriteGroup.
This commit is contained in:
@@ -1034,6 +1034,7 @@ class FreeplayState extends MusicBeatSubState
|
||||
if (fromResults.oldRank != null)
|
||||
{
|
||||
capsuleToRank.fakeRanking.rank = fromResults.oldRank;
|
||||
capsuleToRank.fakeBlurredRanking.rank = fromResults.oldRank;
|
||||
|
||||
sparks.frames = Paths.getSparrowAtlas('freeplay/sparks');
|
||||
sparks.animation.addByPrefix('sparks', 'sparks', 24, false);
|
||||
@@ -1067,6 +1068,7 @@ class FreeplayState extends MusicBeatSubState
|
||||
trace(originalPos);
|
||||
|
||||
capsuleToRank.ranking.visible = false;
|
||||
capsuleToRank.blurredRanking.visible = false;
|
||||
|
||||
// Rank animation vibrations.
|
||||
HapticUtil.increasingVibrate(Constants.MIN_VIBRATION_AMPLITUDE, Constants.MAX_VIBRATION_AMPLITUDE, 0.6);
|
||||
@@ -1090,23 +1092,30 @@ class FreeplayState extends MusicBeatSubState
|
||||
|
||||
function rankDisplayNew(fromResults:Null<FromResultsParams>, capsuleToRank:SongMenuItem):Void
|
||||
{
|
||||
capsuleToRank.ranking.visible = false;
|
||||
capsuleToRank.fakeRanking.visible = false;
|
||||
capsuleToRank.ranking.visible = true;
|
||||
capsuleToRank.blurredRanking.visible = true;
|
||||
capsuleToRank.ranking.scale.set(20, 20);
|
||||
capsuleToRank.blurredRanking.scale.set(20, 20);
|
||||
|
||||
if (fromResults != null && fromResults.newRank != null)
|
||||
{
|
||||
capsuleToRank.ranking.playAnimationEach(fromResults.newRank.getFreeplayRankIconAsset(), true);
|
||||
capsuleToRank.ranking.animation.play(fromResults.newRank.getFreeplayRankIconAsset(), true);
|
||||
}
|
||||
|
||||
FlxTween.tween(capsuleToRank.ranking, {"scale.x": 0.9, "scale.y": 0.9}, 0.1);
|
||||
|
||||
if (fromResults != null && fromResults.newRank != null)
|
||||
{
|
||||
capsuleToRank.blurredRanking.animation.play(fromResults.newRank.getFreeplayRankIconAsset(), true);
|
||||
}
|
||||
FlxTween.tween(capsuleToRank.blurredRanking, {"scale.x": 0.9, "scale.y": 0.9}, 0.1);
|
||||
|
||||
new FlxTimer().start(0.1, _ -> {
|
||||
capsuleToRank.ranking.visible = true;
|
||||
|
||||
if (fromResults?.oldRank != null)
|
||||
{
|
||||
capsuleToRank.fakeRanking.visible = false;
|
||||
capsuleToRank.fakeBlurredRanking.visible = false;
|
||||
|
||||
sparks.visible = true;
|
||||
sparksADD.visible = true;
|
||||
|
||||
@@ -47,8 +47,10 @@ class SongMenuItem extends FlxSpriteGroup
|
||||
public var favIcon:FlxSprite;
|
||||
|
||||
public var ranking:FreeplayRank;
|
||||
public var blurredRanking:FreeplayRank;
|
||||
|
||||
public var fakeRanking:FreeplayRank;
|
||||
public var fakeBlurredRanking:FreeplayRank;
|
||||
|
||||
public var targetPos:FlxPoint = new FlxPoint();
|
||||
public var doLerp:Bool = false;
|
||||
@@ -144,18 +146,28 @@ class SongMenuItem extends FlxSpriteGroup
|
||||
// doesn't get added, simply is here to help with visibility of things for the pop in!
|
||||
grpHide = new FlxGroup();
|
||||
|
||||
fakeRanking = new FreeplayRank(400, 15);
|
||||
fakeRanking = new FreeplayRank(420, 41);
|
||||
add(fakeRanking);
|
||||
|
||||
fakeBlurredRanking = new FreeplayRank(fakeRanking.x, fakeRanking.y);
|
||||
fakeBlurredRanking.shader = new GaussianBlurShader(1);
|
||||
add(fakeBlurredRanking);
|
||||
|
||||
fakeRanking.visible = false;
|
||||
fakeBlurredRanking.visible = false;
|
||||
|
||||
fakeRanking.visible = false;
|
||||
|
||||
ranking = new FreeplayRank(400, 15);
|
||||
ranking = new FreeplayRank(420, 41);
|
||||
add(ranking);
|
||||
|
||||
blurredRanking = new FreeplayRank(ranking.x, ranking.y);
|
||||
blurredRanking.shader = new GaussianBlurShader(1);
|
||||
add(blurredRanking);
|
||||
|
||||
sparkle = new FlxSprite(ranking.x, ranking.y);
|
||||
sparkle.frames = Paths.getSparrowAtlas('freeplay/sparkle');
|
||||
sparkle.animation.addByPrefix('sparkle', 'sparkle Export0', 24, false);
|
||||
sparkle.offset.set(-20, -26);
|
||||
sparkle.animation.play('sparkle', true);
|
||||
sparkle.scale.set(0.8, 0.8);
|
||||
sparkle.blend = BlendMode.ADD;
|
||||
@@ -465,6 +477,7 @@ class SongMenuItem extends FlxSpriteGroup
|
||||
sparkle.visible = false;
|
||||
|
||||
this.ranking.rank = newRank;
|
||||
this.blurredRanking.rank = newRank;
|
||||
|
||||
if (newRank == PERFECT_GOLD)
|
||||
{
|
||||
@@ -755,16 +768,10 @@ class SongMenuItem extends FlxSpriteGroup
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Holds blurred and unblurred versions of the rank icon
|
||||
*/
|
||||
class FreeplayRank extends FlxSpriteGroup
|
||||
class FreeplayRank extends FlxSprite
|
||||
{
|
||||
public var rank(default, set):Null<ScoringRank> = null;
|
||||
|
||||
var spr:FlxSprite;
|
||||
var blur:FlxSprite;
|
||||
|
||||
function set_rank(val:Null<ScoringRank>):Null<ScoringRank>
|
||||
{
|
||||
rank = val;
|
||||
@@ -777,8 +784,7 @@ class FreeplayRank extends FlxSpriteGroup
|
||||
{
|
||||
this.visible = true;
|
||||
|
||||
spr.animation.play(val.getFreeplayRankIconAsset(), true, false);
|
||||
blur.animation.play(val.getFreeplayRankIconAsset(), true, false);
|
||||
animation.play(val.getFreeplayRankIconAsset(), true, false);
|
||||
|
||||
centerOffsets(false);
|
||||
|
||||
@@ -815,24 +821,14 @@ class FreeplayRank extends FlxSpriteGroup
|
||||
{
|
||||
super(x, y);
|
||||
|
||||
blur = new FlxSprite();
|
||||
blur.frames = Paths.getSparrowAtlas('freeplay/rankbadges');
|
||||
blur.shader = new GaussianBlurShader(1);
|
||||
add(blur);
|
||||
frames = Paths.getSparrowAtlas('freeplay/rankbadges');
|
||||
|
||||
spr = new FlxSprite();
|
||||
spr.frames = Paths.getSparrowAtlas('freeplay/rankbadges');
|
||||
add(spr);
|
||||
|
||||
for (i in members)
|
||||
{
|
||||
i.animation.addByPrefix('PERFECT', 'PERFECT rank0', 24, false);
|
||||
i.animation.addByPrefix('EXCELLENT', 'EXCELLENT rank0', 24, false);
|
||||
i.animation.addByPrefix('GOOD', 'GOOD rank0', 24, false);
|
||||
i.animation.addByPrefix('PERFECTSICK', 'PERFECT rank GOLD', 24, false);
|
||||
i.animation.addByPrefix('GREAT', 'GREAT rank0', 24, false);
|
||||
i.animation.addByPrefix('LOSS', 'LOSS rank0', 24, false);
|
||||
}
|
||||
animation.addByPrefix('PERFECT', 'PERFECT rank0', 24, false);
|
||||
animation.addByPrefix('EXCELLENT', 'EXCELLENT rank0', 24, false);
|
||||
animation.addByPrefix('GOOD', 'GOOD rank0', 24, false);
|
||||
animation.addByPrefix('PERFECTSICK', 'PERFECT rank GOLD', 24, false);
|
||||
animation.addByPrefix('GREAT', 'GREAT rank0', 24, false);
|
||||
animation.addByPrefix('LOSS', 'LOSS rank0', 24, false);
|
||||
|
||||
blend = BlendMode.ADD;
|
||||
|
||||
@@ -842,22 +838,6 @@ class FreeplayRank extends FlxSpriteGroup
|
||||
scale.set(0.9, 0.9);
|
||||
updateHitbox();
|
||||
}
|
||||
|
||||
/**
|
||||
* Plays an animation for each member of the group
|
||||
* Just passes the arguments to `animation.play`, since that's not available in FlxGroups
|
||||
* @param animName The name of the animation to play
|
||||
* @param force false
|
||||
* @param reversed false
|
||||
* @param frame 0
|
||||
*/
|
||||
public function playAnimationEach(animName:String, force = false, reversed = false, frame = 0):Void
|
||||
{
|
||||
for (i in members)
|
||||
{
|
||||
i.animation.play(animName, force, reversed, frame);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class CapsuleNumber extends FlxSprite
|
||||
|
||||
Reference in New Issue
Block a user