1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-12-26 15:07:14 +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;
});
generateSongList();
generateSongList(null, false);
// FlxG.sound.playMusic(Paths.music('title'), 0);
// FlxG.sound.music.fadeIn(2, 0, 0.8);
@ -468,7 +468,10 @@ class FreeplayState extends MusicBeatSubState
{
curSelected = 1;
grpCapsules.clear();
for (cap in grpCapsules.members)
cap.kill();
// grpCapsules.clear();
// var regexp:EReg = regexp;
var tempSongs:Array<FreeplaySongData> = songs;
@ -499,23 +502,8 @@ class FreeplayState extends MusicBeatSubState
}
}
// if (regexp != null)
// tempSongs = songs.filter(item -> regexp.match(item.songName));
// 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");
var randomCapsule:SongMenuItem = grpCapsules.recycle(SongMenuItem);
randomCapsule.init(FlxG.width, 0, "Random");
randomCapsule.onConfirm = function() {
trace("RANDOM SELECTED");
};
@ -529,7 +517,8 @@ class FreeplayState extends MusicBeatSubState
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);
funnyMenu.onConfirm = capsuleOnConfirmDefault;
funnyMenu.y = funnyMenu.intendedY(i + 1) + 10;
@ -540,20 +529,12 @@ class FreeplayState extends MusicBeatSubState
funnyMenu.favIcon.visible = tempSongs[i].isFav;
// 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);
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();
@ -958,8 +939,6 @@ class FreeplayState extends MusicBeatSubState
{
// fp.updateScore(12345);
NGio.logEvent('Fresh');
// NGio.logEvent('Fresh');
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);
#end
var bullShit:Int = 0;
for (index => capsule in grpCapsules.members)
{
index += 1;

View file

@ -38,16 +38,12 @@ class LetterSort extends FlxTypedSpriteGroup<FlxSprite>
letter.x += 50;
letter.y += 50;
letter.ogY = y;
// letter.visible = false;
add(letter);
letters.push(letter);
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;
@ -242,9 +238,6 @@ class FreeplayLetter extends FlxAtlasSprite
this.anim.play(animName);
if (curSelection != curLetter)
{
trace(animName);
trace(curLetter);
trace(curSelection);
this.anim.pause();
}
// updateHitbox();

View file

@ -50,6 +50,7 @@ class SongMenuItem extends FlxSpriteGroup
pixelIcon = new FlxSprite(80, 35);
pixelIcon.makeGraphic(32, 32, 0x00000000);
pixelIcon.antialiasing = false;
pixelIcon.active = false;
add(pixelIcon);
if (character != null) setCharacter(character);
@ -64,6 +65,17 @@ class SongMenuItem extends FlxSpriteGroup
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]
* @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
{
frameInTypeBeat = 0;
new FlxTimer().start((1 / 24) * maxTimer, function(doShit) {
doJumpIn = true;
});
@ -111,18 +125,41 @@ class SongMenuItem extends FlxSpriteGroup
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;
alpha = 1;
});
}
else
{
songText.visible = true;
alpha = 1;
}
}
public function forcePosition()
{
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)