1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-11-09 00:04:42 +00:00

better grouping stuf

This commit is contained in:
Cameron Taylor 2023-08-12 00:31:43 -04:00 committed by EliteMasterEric
parent eacd76a0fa
commit f474c3aac5

View file

@ -1,5 +1,6 @@
package funkin.freeplayStuff; package funkin.freeplayStuff;
import flixel.group.FlxGroup;
import flixel.FlxSprite; import flixel.FlxSprite;
import flixel.graphics.frames.FlxAtlasFrames; import flixel.graphics.frames.FlxAtlasFrames;
import flixel.group.FlxSpriteGroup.FlxTypedSpriteGroup; import flixel.group.FlxSpriteGroup.FlxTypedSpriteGroup;
@ -52,6 +53,9 @@ class SongMenuItem extends FlxSpriteGroup
// capsule.animation // capsule.animation
add(capsule); add(capsule);
// doesn't get added, simply is here to help with visibility of things for the pop in!
grpHide = new FlxGroup();
var rank:String = FlxG.random.getObject(ranks); var rank:String = FlxG.random.getObject(ranks);
ranking = new FlxSprite(capsule.width * 0.78, 30); ranking = new FlxSprite(capsule.width * 0.78, 30);
@ -59,12 +63,15 @@ class SongMenuItem extends FlxSpriteGroup
ranking.scale.x = ranking.scale.y = realScaled; ranking.scale.x = ranking.scale.y = realScaled;
ranking.alpha = 0.75; ranking.alpha = 0.75;
add(ranking); add(ranking);
grpHide.add(ranking);
diffGrayscale = new Grayscale(1); diffGrayscale = new Grayscale(1);
var diffRank = new FlxSprite(145, 90).loadGraphic(Paths.image("freeplay/diffRankings/diff" + FlxG.random.getObject(diffRanks))); var diffRank = new FlxSprite(145, 90).loadGraphic(Paths.image("freeplay/diffRankings/diff" + FlxG.random.getObject(diffRanks)));
diffRank.shader = diffGrayscale; diffRank.shader = diffGrayscale;
diffRank.visible = false;
add(diffRank); add(diffRank);
grpHide.add(diffRank);
switch (rank) switch (rank)
{ {
@ -72,16 +79,18 @@ class SongMenuItem extends FlxSpriteGroup
ranking.x -= 10; ranking.x -= 10;
} }
songText = new FlxText(capsule.width * 0.23, 40, 0, songTitle, Std.int(40 * realScaled)); songText = new FlxText(capsule.width * 0.26, 45, 0, songTitle, Std.int(40 * realScaled));
songText.font = "5by7"; songText.font = "5by7";
songText.color = 0xFF43C1EA; songText.color = 0xFF43C1EA;
add(songText); add(songText);
grpHide.add(songText);
pixelIcon = new FlxSprite(80, 35); pixelIcon = new FlxSprite(80, 35);
pixelIcon.makeGraphic(32, 32, 0x00000000); pixelIcon.makeGraphic(32, 32, 0x00000000);
pixelIcon.antialiasing = false; pixelIcon.antialiasing = false;
pixelIcon.active = false; pixelIcon.active = false;
add(pixelIcon); add(pixelIcon);
grpHide.add(pixelIcon);
if (character != null) setCharacter(character); if (character != null) setCharacter(character);
@ -91,10 +100,21 @@ class SongMenuItem extends FlxSpriteGroup
favIcon.animation.play('fav'); favIcon.animation.play('fav');
favIcon.setGraphicSize(60, 60); favIcon.setGraphicSize(60, 60);
add(favIcon); add(favIcon);
grpHide.add(favIcon);
setVisibleGrp(false);
selected = selected; // just to kickstart the set_selected selected = selected; // just to kickstart the set_selected
} }
function setVisibleGrp(value:Bool)
{
for (spr in grpHide.members)
{
spr.visible = value;
}
}
public function init(x:Float, y:Float, song:String, ?character:String) public function init(x:Float, y:Float, song:String, ?character:String)
{ {
this.x = x; this.x = x;
@ -158,17 +178,19 @@ class SongMenuItem extends FlxSpriteGroup
if (force) if (force)
{ {
alpha = 1; alpha = 1;
songText.visible = true; setVisibleGrp(true);
} }
else else
{ {
new FlxTimer().start((xFrames.length / 24) * 2.5, function(_) { new FlxTimer().start((xFrames.length / 24) * 2.5, function(_) {
songText.visible = true; setVisibleGrp(true);
alpha = 1; alpha = 1;
}); });
} }
} }
var grpHide:FlxGroup;
public function forcePosition() public function forcePosition()
{ {
alpha = 1; alpha = 1;
@ -189,7 +211,7 @@ class SongMenuItem extends FlxSpriteGroup
capsule.scale.x *= realScaled; capsule.scale.x *= realScaled;
capsule.scale.y *= realScaled; capsule.scale.y *= realScaled;
songText.visible = true; setVisibleGrp(true);
} }
override function update(elapsed:Float) override function update(elapsed:Float)