1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-12-23 21:56:46 +00:00

Animated pixel icons for freeplay

mend
This commit is contained in:
EliteMasterEric 2024-06-27 19:50:38 -04:00 committed by Cameron Taylor
parent dd30012d80
commit 432c709075
3 changed files with 41 additions and 5 deletions

2
assets

@ -1 +1 @@
Subproject commit 225e248f148a92500a6fe90e4f10e4cd2acee782
Subproject commit c274cf6d5a9d7e9e275f1f22d87d628eb379da5b

View file

@ -1738,7 +1738,7 @@ class FreeplayState extends MusicBeatSubState
dj.confirm();
grpCapsules.members[curSelected].forcePosition();
grpCapsules.members[curSelected].songText.flickerText();
grpCapsules.members[curSelected].confirm();
// FlxTween.color(bgDad, 0.33, 0xFFFFFFFF, 0xFF555555, {ease: FlxEase.quadOut});
FlxTween.color(pinkBack, 0.33, 0xFFFFD0D5, 0xFF171831, {ease: FlxEase.quadOut});

View file

@ -543,8 +543,6 @@ class SongMenuItem extends FlxSpriteGroup
charPath += 'monsterpixel';
case 'mom-car':
charPath += 'mommypixel';
case 'dad':
charPath += 'daddypixel';
case 'darnell-blazin':
charPath += 'darnellpixel';
case 'senpai-angry':
@ -559,7 +557,17 @@ class SongMenuItem extends FlxSpriteGroup
return;
}
pixelIcon.loadGraphic(Paths.image(charPath));
var isAnimated = openfl.utils.Assets.exists(Paths.file('images/$charPath.xml'));
if (isAnimated)
{
pixelIcon.frames = Paths.getSparrowAtlas(charPath);
}
else
{
pixelIcon.loadGraphic(Paths.image(charPath));
}
pixelIcon.scale.x = pixelIcon.scale.y = 2;
switch (char)
@ -571,6 +579,22 @@ class SongMenuItem extends FlxSpriteGroup
}
// pixelIcon.origin.x = capsule.origin.x;
// pixelIcon.offset.x -= pixelIcon.origin.x;
if (isAnimated)
{
pixelIcon.active = true;
pixelIcon.animation.addByPrefix('idle', 'idle0', 10, true);
pixelIcon.animation.addByPrefix('confirm', 'confirm0', 10, false);
pixelIcon.animation.addByPrefix('confirm-hold', 'confirm-hold0', 10, true);
pixelIcon.animation.finishCallback = function(name:String):Void {
trace('Finish pixel animation: ${name}');
if (name == 'confirm') pixelIcon.animation.play('confirm-hold');
};
pixelIcon.animation.play('idle');
}
}
var frameInTicker:Float = 0;
@ -711,6 +735,18 @@ class SongMenuItem extends FlxSpriteGroup
super.update(elapsed);
}
/**
* Play any animations associated with selecting this song.
*/
public function confirm():Void
{
if (songText != null) songText.flickerText();
if (pixelIcon != null)
{
pixelIcon.animation.play('confirm');
}
}
public function intendedY(index:Int):Float
{
return (index * ((height * realScaled) + 10)) + 120;