From 3eff5398f448464a5101d68520dad293b09e15ce Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Thu, 1 Apr 2021 19:28:20 -0700 Subject: [PATCH] dumbass sort maybe lol! --- source/PlayState.hx | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/source/PlayState.hx b/source/PlayState.hx index 3b5545ced..0987aa96e 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -149,6 +149,9 @@ class PlayState extends MusicBeatState if (FlxG.sound.music != null) FlxG.sound.music.stop(); + FlxG.sound.cache(Paths.inst(PlayState.SONG.song)); + FlxG.sound.cache(Paths.voices(PlayState.SONG.song)); + // var gameCam:FlxCamera = FlxG.camera; camGame = new FlxCamera(); camHUD = new FlxCamera(); @@ -157,6 +160,11 @@ class PlayState extends MusicBeatState FlxG.cameras.reset(camGame); FlxG.cameras.add(camHUD, false); + // fake notesplash cache type deal so that it loads in the graphic? + var noteSplash:NoteSplash = new NoteSplash(100, 100, 0); + add(noteSplash); + noteSplash.alpha = 0.1; + persistentUpdate = true; persistentDraw = true; @@ -1225,11 +1233,23 @@ class PlayState extends MusicBeatState generatedMusic = true; } + // Now you are probably wondering why I made 2 of these very similar functions + // sortByShit(), and sortNotes(). sortNotes is meant to be used by both sortByShit(), and the notes FlxGroup + // sortByShit() is meant to be used only by the unspawnNotes array. + // and the array sorting function doesnt need that order variable thingie + // this is good enough for now lololol HERE IS COMMENT FOR THIS SORTA DUMB DECISION LOL function sortByShit(Obj1:Note, Obj2:Note):Int { - return FlxSort.byValues(FlxSort.ASCENDING, Obj1.strumTime, Obj2.strumTime); + return sortNotes(FlxSort.ASCENDING, Obj1, Obj2); } + function sortNotes(order:Int = FlxSort.ASCENDING, Obj1:Note, Obj2:Note) + { + return FlxSort.byValues(order, Obj1.strumTime, Obj2.strumTime); + } + + // ^ These two sorts also look cute together ^ + private function generateStaticArrows(player:Int):Void { for (i in 0...4) @@ -1659,7 +1679,7 @@ class PlayState extends MusicBeatState notes.add(dunceNote); var index:Int = unspawnNotes.indexOf(dunceNote); - unspawnNotes.splice(index, 1); + unspawnNotes.shift(); } if (generatedMusic) @@ -2430,7 +2450,7 @@ class PlayState extends MusicBeatState if (generatedMusic) { - notes.sort(FlxSort.byY, FlxSort.DESCENDING); + notes.sort(sortNotes, FlxSort.DESCENDING); } if (SONG.notes[Math.floor(curStep / 16)] != null)