1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-12-27 07:27:12 +00:00

pixel icons

This commit is contained in:
Cameron Taylor 2023-08-08 14:35:07 -04:00 committed by EliteMasterEric
parent 8052773f92
commit 92f45d93aa
3 changed files with 44 additions and 10 deletions

2
assets

@ -1 +1 @@
Subproject commit b3fec73999ce576d009f70b345f19da6b5f0f82a
Subproject commit b0bd61a2f0fa9be900a236f20662601bd4d81a1d

View file

@ -530,6 +530,7 @@ class FreeplayState extends MusicBeatSubState
for (i in 0...tempSongs.length)
{
var funnyMenu:SongMenuItem = new SongMenuItem(FlxG.width, 0, tempSongs[i].songName);
if (tempSongs[i].songCharacter != null) funnyMenu.setCharacter(tempSongs[i].songCharacter);
funnyMenu.onConfirm = capsuleOnConfirmDefault;
funnyMenu.y = funnyMenu.intendedY(i + 1) + 10;
funnyMenu.targetPos.x = funnyMenu.x;

View file

@ -12,6 +12,7 @@ import flixel.util.FlxTimer;
class SongMenuItem extends FlxSpriteGroup
{
var capsule:FlxSprite;
var pixelIcon:FlxSprite;
public var selected(default, set):Bool = false;
@ -28,7 +29,7 @@ class SongMenuItem extends FlxSpriteGroup
public var onConfirm:Void->Void;
public function new(x:Float, y:Float, song:String)
public function new(x:Float, y:Float, song:String, ?character:String)
{
super(x, y);
@ -46,6 +47,13 @@ class SongMenuItem extends FlxSpriteGroup
songText.color = 0xFF43C1EA;
add(songText);
pixelIcon = new FlxSprite(80, 35);
pixelIcon.makeGraphic(32, 32, 0x00000000);
pixelIcon.antialiasing = false;
add(pixelIcon);
if (character != null) setCharacter(character);
favIcon = new FlxSprite(400, 40);
favIcon.frames = Paths.getSparrowAtlas('freeplay/favHeart');
favIcon.animation.addByPrefix('fav', "favorite heart", 24, false);
@ -56,6 +64,31 @@ class SongMenuItem extends FlxSpriteGroup
selected = selected; // just to kickstart the set_selected
}
/**
* [Description]
* @param char Should be songCharacter, and will get translated to the correct path via switch
*/
public function setCharacter(char:String)
{
var charPath:String = "freeplay/icons/";
switch (char)
{
case "monster-christmas":
charPath += "monsterpixel";
case "mom":
charPath += "mommypixel";
case "dad":
charPath += "daddypixel";
default:
charPath += char + "pixel";
}
pixelIcon.loadGraphic(Paths.image(charPath));
pixelIcon.setGraphicSize(Std.int(pixelIcon.width * 2));
// pixelIcon.updateHitbox();
}
var frameInTicker:Float = 0;
var frameInTypeBeat:Int = 0;
@ -102,12 +135,12 @@ class SongMenuItem extends FlxSpriteGroup
{
frameInTicker = 0;
scale.x = xFrames[frameInTypeBeat];
scale.y = 1 / xFrames[frameInTypeBeat];
capsule.scale.x = xFrames[frameInTypeBeat];
capsule.scale.y = 1 / xFrames[frameInTypeBeat];
x = FlxG.width * xPosLerpLol[Std.int(Math.min(frameInTypeBeat, xPosLerpLol.length - 1))];
scale.x *= realScaled;
scale.y *= realScaled;
capsule.scale.x *= realScaled;
capsule.scale.y *= realScaled;
frameInTypeBeat += 1;
}
@ -121,12 +154,12 @@ class SongMenuItem extends FlxSpriteGroup
{
frameOutTicker = 0;
scale.x = xFrames[frameOutTypeBeat];
scale.y = 1 / xFrames[frameOutTypeBeat];
capsule.scale.x = xFrames[frameOutTypeBeat];
capsule.scale.y = 1 / xFrames[frameOutTypeBeat];
x = FlxG.width * xPosOutLerpLol[Std.int(Math.min(frameOutTypeBeat, xPosOutLerpLol.length - 1))];
scale.x *= realScaled;
scale.y *= realScaled;
capsule.scale.x *= realScaled;
capsule.scale.y *= realScaled;
frameOutTypeBeat += 1;
}