From f411cdac8805a721c7ea0b18b4023b7dc37a158c Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Sun, 16 Apr 2023 15:33:20 -0400 Subject: [PATCH] different result screen in progress --- hmm.json | 4 +- .../graphics/adobeanimate/FlxAtlasSprite.hx | 9 ++- source/funkin/play/ResultState.hx | 72 ++++++++++++------- 3 files changed, 53 insertions(+), 32 deletions(-) diff --git a/hmm.json b/hmm.json index 69f5827a5..fd04b6b96 100644 --- a/hmm.json +++ b/hmm.json @@ -30,8 +30,8 @@ "name": "flxanimate", "type": "git", "dir": null, - "ref": "49f5554", - "url": "https://github.com/Dot-Stuff/flxanimate" + "ref": "6bc8992", + "url": "https://github.com/ninjamuffin99/flxanimate" }, { "name": "format", diff --git a/source/funkin/graphics/adobeanimate/FlxAtlasSprite.hx b/source/funkin/graphics/adobeanimate/FlxAtlasSprite.hx index e79b06277..aad9cd851 100644 --- a/source/funkin/graphics/adobeanimate/FlxAtlasSprite.hx +++ b/source/funkin/graphics/adobeanimate/FlxAtlasSprite.hx @@ -31,9 +31,11 @@ class FlxAtlasSprite extends FlxAnimate var canPlayOtherAnims:Bool = true; - public function new(x:Float, y:Float, path:String) + public function new(x:Float, y:Float, path:String, ?settings:Settings) { - super(x, y, path); + if (settings == null) settings = SETTINGS; + + super(x, y, path, settings); if (this.anim.curInstance == null) { @@ -55,7 +57,8 @@ class FlxAtlasSprite extends FlxAnimate */ public function listAnimations():Array { - return this.anim.getFrameLabels(); + // return this.anim.getFrameLabels(); + return [""]; } /** diff --git a/source/funkin/play/ResultState.hx b/source/funkin/play/ResultState.hx index 59879c5a4..aef346ec5 100644 --- a/source/funkin/play/ResultState.hx +++ b/source/funkin/play/ResultState.hx @@ -1,5 +1,6 @@ package funkin.play; +import funkin.graphics.adobeanimate.FlxAtlasSprite; import flixel.FlxBasic; import flixel.FlxSprite; import flixel.graphics.frames.FlxAtlasFrames; @@ -16,6 +17,7 @@ import flixel.util.FlxGradient; import flixel.util.FlxTimer; import funkin.shaderslmfao.LeftMaskShader; import funkin.ui.TallyCounter; +import flxanimate.FlxAnimate.Settings; class ResultState extends MusicBeatSubstate { @@ -50,12 +52,32 @@ class ResultState extends MusicBeatSubstate bg.scrollFactor.set(); add(bg); + var bfGfExcellent:FlxAtlasSprite = new FlxAtlasSprite(380, -170, Paths.animateAtlas("resultScreen/resultsBoyfriendExcellent", "shared")); + bfGfExcellent.visible = false; + // trace(bfGfExcellent.listAnimations()); + add(bfGfExcellent); + var settings:Settings = + { + // ?ButtonSettings:Map, + FrameRate: 24.0, + Reversed: false, + OnComplete: function() { + bfGfExcellent.anim.curFrame = 28; + trace("repeated anim!!"); + }, + ShowPivot: false, + Antialiasing: true, + ScrollFactor: new FlxPoint(1, 1), + // Offset: new FlxPoint(0, 0), // This is just FlxSprite.offset + }; + + bfGfExcellent.setTheSettings(settings); + var gf:FlxSprite = new FlxSprite(500, 300); gf.frames = Paths.getSparrowAtlas('resultScreen/resultGirlfriendGOOD'); gf.animation.addByPrefix("clap", "Girlfriend Good Anim", 24, false); gf.visible = false; - gf.animation.finishCallback = _ -> - { + gf.animation.finishCallback = _ -> { gf.animation.play('clap', true, false, 9); }; add(gf); @@ -64,8 +86,7 @@ class ResultState extends MusicBeatSubstate boyfriend.frames = Paths.getSparrowAtlas('resultScreen/resultBoyfriendGOOD'); boyfriend.animation.addByPrefix("fall", "Boyfriend Good", 24, false); boyfriend.visible = false; - boyfriend.animation.finishCallback = function(_) - { + boyfriend.animation.finishCallback = function(_) { boyfriend.animation.play('fall', true, false, 14); }; @@ -75,8 +96,7 @@ class ResultState extends MusicBeatSubstate soundSystem.frames = Paths.getSparrowAtlas("resultScreen/soundSystem"); soundSystem.animation.addByPrefix("idle", "sound system", 24, false); soundSystem.visible = false; - new FlxTimer().start(0.4, _ -> - { + new FlxTimer().start(0.4, _ -> { soundSystem.animation.play("idle"); soundSystem.visible = true; }); @@ -193,20 +213,17 @@ class ResultState extends MusicBeatSubstate for (ind => rating in ratingGrp.members) { rating.visible = false; - new FlxTimer().start((0.3 * ind) + 0.55, _ -> - { + new FlxTimer().start((0.3 * ind) + 0.55, _ -> { rating.visible = true; FlxTween.tween(rating, {curNumber: rating.neededNumber}, 0.5, {ease: FlxEase.quartOut}); }); } - new FlxTimer().start(0.5, _ -> - { + new FlxTimer().start(0.5, _ -> { ratingsPopin.animation.play("idle"); ratingsPopin.visible = true; - ratingsPopin.animation.finishCallback = anim -> - { + ratingsPopin.animation.finishCallback = anim -> { scorePopin.animation.play("score"); scorePopin.visible = true; @@ -215,15 +232,22 @@ class ResultState extends MusicBeatSubstate FlxTween.tween(highscoreNew, {y: highscoreNew.y + 10}, 0.8, {ease: FlxEase.quartOut}); }; - boyfriend.animation.play('fall'); - boyfriend.visible = true; - - new FlxTimer().start((1 / 24) * 22, _ -> + if (false) { - // plays about 22 frames (at 24fps timing) after bf spawns in - gf.animation.play('clap', true); - gf.visible = true; - }); + boyfriend.animation.play('fall'); + boyfriend.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; + }); + } + else + { + bfGfExcellent.visible = true; + bfGfExcellent.playAnimation(""); + } }); if (Highscore.tallies.isNewHighscore) trace("ITS A NEW HIGHSCORE!!!"); @@ -245,8 +269,7 @@ class ResultState extends MusicBeatSubstate songName.y = diffYTween - 30; songName.x = (difficulty.x + difficulty.width) + 20; - new FlxTimer().start(3, _ -> - { + new FlxTimer().start(3, _ -> { movingSongStuff = true; }); } @@ -297,11 +320,6 @@ class ResultState extends MusicBeatSubstate if (FlxG.keys.justPressed.DOWN) speedOfTween.y += 0.1; - if (FlxG.keys.pressed.V) - { - trace(speedOfTween); - } - if (FlxG.keys.justPressed.PERIOD) songName.angle += 0.1; if (FlxG.keys.justPressed.COMMA) songName.angle -= 0.1;