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

polish / optimize in progress

This commit is contained in:
Cameron Taylor 2023-08-09 02:47:22 -04:00 committed by EliteMasterEric
parent 92f45d93aa
commit c3d30f6711
3 changed files with 58 additions and 51 deletions

View file

@ -420,7 +420,7 @@ class FreeplayState extends MusicBeatSubState
grpTxtScrolls.visible = true; grpTxtScrolls.visible = true;
}); });
generateSongList(); generateSongList(null, false);
// FlxG.sound.playMusic(Paths.music('title'), 0); // FlxG.sound.playMusic(Paths.music('title'), 0);
// FlxG.sound.music.fadeIn(2, 0, 0.8); // FlxG.sound.music.fadeIn(2, 0, 0.8);
@ -468,7 +468,10 @@ class FreeplayState extends MusicBeatSubState
{ {
curSelected = 1; curSelected = 1;
grpCapsules.clear(); for (cap in grpCapsules.members)
cap.kill();
// grpCapsules.clear();
// var regexp:EReg = regexp; // var regexp:EReg = regexp;
var tempSongs:Array<FreeplaySongData> = songs; var tempSongs:Array<FreeplaySongData> = songs;
@ -499,23 +502,8 @@ class FreeplayState extends MusicBeatSubState
} }
} }
// if (regexp != null) var randomCapsule:SongMenuItem = grpCapsules.recycle(SongMenuItem);
// tempSongs = songs.filter(item -> regexp.match(item.songName)); randomCapsule.init(FlxG.width, 0, "Random");
// tempSongs.sort(function(a, b):Int
// {
// var tempA = a.songName.toUpperCase();
// var tempB = b.songName.toUpperCase();
// if (tempA < tempB)
// return -1;
// else if (tempA > tempB)
// return 1;
// else
// return 0;
// });
var randomCapsule:SongMenuItem = new SongMenuItem(FlxG.width, 0, "Random");
randomCapsule.onConfirm = function() { randomCapsule.onConfirm = function() {
trace("RANDOM SELECTED"); trace("RANDOM SELECTED");
}; };
@ -529,7 +517,8 @@ class FreeplayState extends MusicBeatSubState
for (i in 0...tempSongs.length) for (i in 0...tempSongs.length)
{ {
var funnyMenu:SongMenuItem = new SongMenuItem(FlxG.width, 0, tempSongs[i].songName); var funnyMenu:SongMenuItem = grpCapsules.recycle(SongMenuItem);
funnyMenu.init(FlxG.width, 0, tempSongs[i].songName);
if (tempSongs[i].songCharacter != null) funnyMenu.setCharacter(tempSongs[i].songCharacter); if (tempSongs[i].songCharacter != null) funnyMenu.setCharacter(tempSongs[i].songCharacter);
funnyMenu.onConfirm = capsuleOnConfirmDefault; funnyMenu.onConfirm = capsuleOnConfirmDefault;
funnyMenu.y = funnyMenu.intendedY(i + 1) + 10; funnyMenu.y = funnyMenu.intendedY(i + 1) + 10;
@ -540,20 +529,12 @@ class FreeplayState extends MusicBeatSubState
funnyMenu.favIcon.visible = tempSongs[i].isFav; funnyMenu.favIcon.visible = tempSongs[i].isFav;
// fp.updateScore(0); // fp.updateScore(0);
funnyMenu.initJumpIn(Math.min(i, 4), force);
if (i < 8) funnyMenu.initJumpIn(Math.min(i, 4), force);
else
funnyMenu.forcePosition();
grpCapsules.add(funnyMenu); grpCapsules.add(funnyMenu);
var songText:Alphabet = new Alphabet(0, (70 * i) + 30, tempSongs[i].songName, true, false);
songText.x += 100;
songText.isMenuItem = true;
songText.targetY = i;
// grpSongs.add(songText);
// songText.x += 40;
// DONT PUT X IN THE FIRST PARAMETER OF new ALPHABET() !!
// songText.screenCenter(X);
} }
changeSelection(); changeSelection();
@ -958,8 +939,6 @@ class FreeplayState extends MusicBeatSubState
{ {
// fp.updateScore(12345); // fp.updateScore(12345);
NGio.logEvent('Fresh');
// NGio.logEvent('Fresh'); // NGio.logEvent('Fresh');
FlxG.sound.play(Paths.sound('scrollMenu'), 0.4); FlxG.sound.play(Paths.sound('scrollMenu'), 0.4);
@ -979,8 +958,6 @@ class FreeplayState extends MusicBeatSubState
// FlxG.sound.playMusic(Paths.inst(songs[curSelected].songName), 0); // FlxG.sound.playMusic(Paths.inst(songs[curSelected].songName), 0);
#end #end
var bullShit:Int = 0;
for (index => capsule in grpCapsules.members) for (index => capsule in grpCapsules.members)
{ {
index += 1; index += 1;

View file

@ -38,16 +38,12 @@ class LetterSort extends FlxTypedSpriteGroup<FlxSprite>
letter.x += 50; letter.x += 50;
letter.y += 50; letter.y += 50;
letter.ogY = y; letter.ogY = y;
// letter.visible = false;
add(letter); add(letter);
letters.push(letter); letters.push(letter);
if (i != 2) letter.scale.x = letter.scale.y = 0.8; if (i != 2) letter.scale.x = letter.scale.y = 0.8;
else
{
// letter.x += 10;
// letter.scale.x = letter.scale.y = 1.1;
}
var darkness:Float = Math.abs(i - 2) / 6; var darkness:Float = Math.abs(i - 2) / 6;
@ -242,9 +238,6 @@ class FreeplayLetter extends FlxAtlasSprite
this.anim.play(animName); this.anim.play(animName);
if (curSelection != curLetter) if (curSelection != curLetter)
{ {
trace(animName);
trace(curLetter);
trace(curSelection);
this.anim.pause(); this.anim.pause();
} }
// updateHitbox(); // updateHitbox();

View file

@ -50,6 +50,7 @@ class SongMenuItem extends FlxSpriteGroup
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;
add(pixelIcon); add(pixelIcon);
if (character != null) setCharacter(character); if (character != null) setCharacter(character);
@ -64,6 +65,17 @@ class SongMenuItem extends FlxSpriteGroup
selected = selected; // just to kickstart the set_selected selected = selected; // just to kickstart the set_selected
} }
public function init(x:Float, y:Float, song:String, ?character:String)
{
this.x = x;
this.y = y;
this.songTitle = song;
songText.text = this.songTitle;
if (character != null) setCharacter(character);
selected = selected;
}
/** /**
* [Description] * [Description]
* @param char Should be songCharacter, and will get translated to the correct path via switch * @param char Should be songCharacter, and will get translated to the correct path via switch
@ -103,6 +115,8 @@ class SongMenuItem extends FlxSpriteGroup
public function initJumpIn(maxTimer:Float, ?force:Bool):Void public function initJumpIn(maxTimer:Float, ?force:Bool):Void
{ {
frameInTypeBeat = 0;
new FlxTimer().start((1 / 24) * maxTimer, function(doShit) { new FlxTimer().start((1 / 24) * maxTimer, function(doShit) {
doJumpIn = true; doJumpIn = true;
}); });
@ -111,18 +125,41 @@ class SongMenuItem extends FlxSpriteGroup
doLerp = true; doLerp = true;
}); });
if (!force) if (force)
{ {
new FlxTimer().start(((0.20 * maxTimer) / (1 + maxTimer)) + 0.75, function(swagShi) { alpha = 1;
songText.visible = true;
}
else
{
new FlxTimer().start((xFrames.length / 24) * 2.5, function(_) {
songText.visible = true; songText.visible = true;
alpha = 1; alpha = 1;
}); });
} }
else }
{
songText.visible = true; public function forcePosition()
alpha = 1; {
} alpha = 1;
doLerp = true;
doJumpIn = false;
doJumpOut = false;
frameInTypeBeat = xFrames.length;
frameOutTypeBeat = 0;
capsule.scale.x = xFrames[frameInTypeBeat - 1];
capsule.scale.y = 1 / xFrames[frameInTypeBeat - 1];
// x = FlxG.width * xPosLerpLol[Std.int(Math.min(frameInTypeBeat - 1, xPosLerpLol.length - 1))];
x = targetPos.x;
y = targetPos.y;
capsule.scale.x *= realScaled;
capsule.scale.y *= realScaled;
songText.visible = true;
} }
override function update(elapsed:Float) override function update(elapsed:Float)