Skip to content

Commit

Permalink
centered notefield functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
Yoshubs authored and Yoshubs committed Sep 11, 2021
1 parent 0bf1c4d commit 716d00c
Showing 1 changed file with 39 additions and 10 deletions.
49 changes: 39 additions & 10 deletions source/gameFolder/meta/state/PlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down Expand Up @@ -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);

Expand All @@ -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<Note> = [];

private function mainControls(daNote:Note, char:Character, charStrum:FlxTypedGroup<UIStaticArrow>, autoplay:Bool, ?otherSide:Int = 0):Void
{
// call character type for later I'm so sorry this is painful
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 716d00c

Please sign in to comment.