From 716d00c3845983becbc028ba30bead7235c59ffa Mon Sep 17 00:00:00 2001 From: Yoshubs <37424048+Yoshubs@users.noreply.github.com> Date: Sat, 11 Sep 2021 19:45:55 -0400 Subject: [PATCH] centered notefield functionality --- source/gameFolder/meta/state/PlayState.hx | 49 ++++++++++++++++++----- 1 file changed, 39 insertions(+), 10 deletions(-) diff --git a/source/gameFolder/meta/state/PlayState.hx b/source/gameFolder/meta/state/PlayState.hx index 488cc162b..96155383b 100644 --- a/source/gameFolder/meta/state/PlayState.hx +++ b/source/gameFolder/meta/state/PlayState.hx @@ -314,7 +314,11 @@ class PlayState extends MusicBeatState startedCountdown = true; for (i in 0...2) - generateStaticArrows(i); + if (i != 0 || !Init.trueSettings.get('Centered Notefield')) + generateStaticArrows(i); + + if (Init.trueSettings.get('Centered Notefield')) + staticDisplace = 4; uiHUD = new ClassHUD(); add(uiHUD); @@ -330,6 +334,8 @@ class PlayState extends MusicBeatState super.create(); } + var staticDisplace:Int = 0; + override public function update(elapsed:Float) { stageBuild.stageUpdateConstant(elapsed, boyfriend, gf, dadOpponent); @@ -516,7 +522,10 @@ class PlayState extends MusicBeatState if ((unspawnNotes[0].strumTime - Conductor.songPosition) < 3500) { var dunceNote:Note = unspawnNotes[0]; - notes.add(dunceNote); + if (!dunceNote.mustPress && Init.trueSettings.get('Centered Notefield')) + animationsPlay.push(dunceNote); + else + notes.add(dunceNote); unspawnNotes.splice(unspawnNotes.indexOf(dunceNote), 1); @@ -525,10 +534,18 @@ class PlayState extends MusicBeatState } } + if (animationsPlay[0] != null && (animationsPlay[0].strumTime - Conductor.songPosition) <= 0) + { + characterPlayAnimation(animationsPlay[0], dadOpponent); + animationsPlay.splice(animationsPlay.indexOf(animationsPlay[0]), 1); + } + // handle all of the note calls noteCalls(); } + var animationsPlay:Array = []; + private function mainControls(daNote:Note, char:Character, charStrum:FlxTypedGroup, autoplay:Bool, ?otherSide:Int = 0):Void { // call character type for later I'm so sorry this is painful @@ -696,13 +713,14 @@ class PlayState extends MusicBeatState // handle strumline stuffs for (i in 0...strumLine.length) - strumLine.members[i].y = strumLineNotes.members[i].y + 25; + if (strumLineNotes.members[i] != null) + strumLine.members[i].y = strumLineNotes.members[i].y + 25; for (i in 0...splashNotes.length) { // splash note positions - splashNotes.members[i].x = strumLineNotes.members[i + 4].x - 48; - splashNotes.members[i].y = strumLineNotes.members[i + 4].y - 56; + splashNotes.members[i].x = strumLineNotes.members[i + 4 - staticDisplace].x - 48; + splashNotes.members[i].y = strumLineNotes.members[i + 4 - staticDisplace].y - 56; } // reset strums @@ -761,10 +779,11 @@ class PlayState extends MusicBeatState var psuedoX = 25 + daNote.noteVisualOffset; - daNote.y = strumLine.members[Math.floor(daNote.noteData + (otherSide * 4))].y + daNote.y = strumLine.members[Math.floor(daNote.noteData + (otherSide * 4 - staticDisplace))].y + (Math.cos(flixel.math.FlxAngle.asRadians(daNote.noteDirection)) * psuedoY) + (Math.sin(flixel.math.FlxAngle.asRadians(daNote.noteDirection)) * psuedoX); - daNote.x = strumLineNotes.members[Math.floor(daNote.noteData + (otherSide * 4))].x + // painful math equation + daNote.x = strumLineNotes.members[Math.floor(daNote.noteData + (otherSide * 4 - staticDisplace))].x + (Math.cos(flixel.math.FlxAngle.asRadians(daNote.noteDirection)) * psuedoX) + (Math.sin(flixel.math.FlxAngle.asRadians(daNote.noteDirection)) * psuedoY); @@ -1318,9 +1337,19 @@ class PlayState extends MusicBeatState dadStrums.add(babyArrow); } - babyArrow.x += 75; - babyArrow.x += Note.swagWidth * i; - babyArrow.x += ((FlxG.width / 2) * player); + if (!Init.trueSettings.get('Centered Notefield')) + { + babyArrow.x += 75; + babyArrow.x += Note.swagWidth * i; + babyArrow.x += ((FlxG.width / 2) * player); + } + else + { + babyArrow.screenCenter(X); + babyArrow.x -= Note.swagWidth; + babyArrow.x -= 54; + babyArrow.x += Note.swagWidth * i; + } babyArrow.initialX = Math.floor(babyArrow.x); babyArrow.initialY = Math.floor(babyArrow.y);