Skip to content

Commit

Permalink
replayable animations
Browse files Browse the repository at this point in the history
  • Loading branch information
lemz1 committed Nov 19, 2024
1 parent 02e1a50 commit 01f20ba
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions source/funkin/ui/debug/char/pages/CharCreatorResultsPage.hx
Original file line number Diff line number Diff line change
Expand Up @@ -57,30 +57,41 @@ class CharCreatorResultsPage extends CharCreatorDefaultPage
menu.addComponent(animDialog);
}

var animTimers:Array<FlxTimer> = [];

override public function update(elapsed:Float):Void
{
super.update(elapsed);

if (FlxG.keys.justPressed.SPACE)
{
while (animTimers.length > 0)
{
var timer = animTimers.shift();
timer.cancel();
timer.destroy();
}

refresh(); // just to be sure

for (atlas in characterAtlasAnimations[previewRank])
{
new FlxTimer().start(atlas.delay, _ -> {
atlas.sprite.visible = false;
animTimers.push(new FlxTimer().start(atlas.delay, _ -> {
if (atlas.sprite == null) return;
atlas.sprite.visible = true;
atlas.sprite.playAnimation('');
});
atlas.sprite.anim.play('', true);
}));
}

for (sprite in characterSparrowAnimations[previewRank])
{
new FlxTimer().start(sprite.delay, _ -> {
sprite.sprite.visible = false;
animTimers.push(new FlxTimer().start(sprite.delay, _ -> {
if (sprite.sprite == null) return;
sprite.sprite.visible = true;
sprite.sprite.animation.play('idle', true);
});
}));
}
}
}
Expand Down

0 comments on commit 01f20ba

Please sign in to comment.