Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better sustain note trails #415

Merged
merged 1 commit into from
Feb 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 7 additions & 33 deletions source/Note.hx
Original file line number Diff line number Diff line change
Expand Up @@ -51,33 +51,7 @@ class Note extends FlxSprite

switch (daStage)
{
case 'school':
loadGraphic('assets/images/weeb/pixelUI/arrows-pixels.png', true, 17, 17);

animation.add('greenScroll', [6]);
animation.add('redScroll', [7]);
animation.add('blueScroll', [5]);
animation.add('purpleScroll', [4]);

if (isSustainNote)
{
loadGraphic('assets/images/weeb/pixelUI/arrowEnds.png', true, 7, 6);

animation.add('purpleholdend', [4]);
animation.add('greenholdend', [6]);
animation.add('redholdend', [7]);
animation.add('blueholdend', [5]);

animation.add('purplehold', [0]);
animation.add('greenhold', [2]);
animation.add('redhold', [3]);
animation.add('bluehold', [1]);
}

setGraphicSize(Std.int(width * PlayState.daPixelZoom));
updateHitbox();

case 'schoolEvil': // COPY PASTED CUZ I AM LAZY
case 'school' | 'schoolEvil':
loadGraphic('assets/images/weeb/pixelUI/arrows-pixels.png', true, 17, 17);

animation.add('greenScroll', [6]);
Expand Down Expand Up @@ -174,18 +148,18 @@ class Note extends FlxSprite
{
switch (prevNote.noteData)
{
case 0:
prevNote.animation.play('purplehold');
case 1:
prevNote.animation.play('bluehold');
case 2:
prevNote.animation.play('greenhold');
case 3:
prevNote.animation.play('redhold');
case 1:
prevNote.animation.play('bluehold');
case 0:
prevNote.animation.play('purplehold');
}

prevNote.offset.y = -19;
prevNote.scale.y *= (2.25 * FlxMath.roundDecimal(PlayState.SONG.speed, 1));
prevNote.scale.y *= Conductor.stepCrochet / 100 * 1.5 * PlayState.SONG.speed;
prevNote.updateHitbox();
// prevNote.setGraphicSize();
}
}
Expand Down
150 changes: 87 additions & 63 deletions source/PlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -1096,6 +1096,16 @@ class PlayState extends MusicBeatState

switch (Math.abs(i))
{
case 0:
babyArrow.x += Note.swagWidth * 0;
babyArrow.animation.add('static', [0]);
babyArrow.animation.add('pressed', [4, 8], 12, false);
babyArrow.animation.add('confirm', [12, 16], 24, false);
case 1:
babyArrow.x += Note.swagWidth * 1;
babyArrow.animation.add('static', [1]);
babyArrow.animation.add('pressed', [5, 9], 12, false);
babyArrow.animation.add('confirm', [13, 17], 24, false);
case 2:
babyArrow.x += Note.swagWidth * 2;
babyArrow.animation.add('static', [2]);
Expand All @@ -1106,16 +1116,6 @@ class PlayState extends MusicBeatState
babyArrow.animation.add('static', [3]);
babyArrow.animation.add('pressed', [7, 11], 12, false);
babyArrow.animation.add('confirm', [15, 19], 24, false);
case 1:
babyArrow.x += Note.swagWidth * 1;
babyArrow.animation.add('static', [1]);
babyArrow.animation.add('pressed', [5, 9], 12, false);
babyArrow.animation.add('confirm', [13, 17], 24, false);
case 0:
babyArrow.x += Note.swagWidth * 0;
babyArrow.animation.add('static', [0]);
babyArrow.animation.add('pressed', [4, 8], 12, false);
babyArrow.animation.add('confirm', [12, 16], 24, false);
}

default:
Expand All @@ -1130,6 +1130,16 @@ class PlayState extends MusicBeatState

switch (Math.abs(i))
{
case 0:
babyArrow.x += Note.swagWidth * 0;
babyArrow.animation.addByPrefix('static', 'arrowLEFT');
babyArrow.animation.addByPrefix('pressed', 'left press', 24, false);
babyArrow.animation.addByPrefix('confirm', 'left confirm', 24, false);
case 1:
babyArrow.x += Note.swagWidth * 1;
babyArrow.animation.addByPrefix('static', 'arrowDOWN');
babyArrow.animation.addByPrefix('pressed', 'down press', 24, false);
babyArrow.animation.addByPrefix('confirm', 'down confirm', 24, false);
case 2:
babyArrow.x += Note.swagWidth * 2;
babyArrow.animation.addByPrefix('static', 'arrowUP');
Expand All @@ -1140,16 +1150,6 @@ class PlayState extends MusicBeatState
babyArrow.animation.addByPrefix('static', 'arrowRIGHT');
babyArrow.animation.addByPrefix('pressed', 'right press', 24, false);
babyArrow.animation.addByPrefix('confirm', 'right confirm', 24, false);
case 1:
babyArrow.x += Note.swagWidth * 1;
babyArrow.animation.addByPrefix('static', 'arrowDOWN');
babyArrow.animation.addByPrefix('pressed', 'down press', 24, false);
babyArrow.animation.addByPrefix('confirm', 'down confirm', 24, false);
case 0:
babyArrow.x += Note.swagWidth * 0;
babyArrow.animation.addByPrefix('static', 'arrowLEFT');
babyArrow.animation.addByPrefix('pressed', 'left press', 24, false);
babyArrow.animation.addByPrefix('confirm', 'left confirm', 24, false);
}
}

Expand Down Expand Up @@ -1501,6 +1501,20 @@ class PlayState extends MusicBeatState
daNote.active = true;
}

daNote.y = (strumLine.y - (Conductor.songPosition - daNote.strumTime) * (0.45 * FlxMath.roundDecimal(SONG.speed, 2)));

// i am so fucking sorry for this if condition
if (daNote.isSustainNote && daNote.y + daNote.offset.y <= strumLine.y + Note.swagWidth/2
&& (!daNote.mustPress || (daNote.wasGoodHit ||
(daNote.prevNote.wasGoodHit && !daNote.canBeHit))))
{
var swagRect = new FlxRect(0, strumLine.y + Note.swagWidth/2 - daNote.y, daNote.width * 2, daNote.height * 2);
swagRect.y /= daNote.scale.y;
swagRect.height -= swagRect.y;

daNote.clipRect = swagRect;
}

if (!daNote.mustPress && daNote.wasGoodHit)
{
if (SONG.song != 'Tutorial')
Expand All @@ -1516,14 +1530,14 @@ class PlayState extends MusicBeatState

switch (Math.abs(daNote.noteData))
{
case 0:
dad.playAnim('singLEFT' + altAnim, true);
case 1:
dad.playAnim('singDOWN' + altAnim, true);
case 2:
dad.playAnim('singUP' + altAnim, true);
case 3:
dad.playAnim('singRIGHT' + altAnim, true);
case 1:
dad.playAnim('singDOWN' + altAnim, true);
case 0:
dad.playAnim('singLEFT' + altAnim, true);
}

dad.holdTimer = 0;
Expand All @@ -1536,25 +1550,32 @@ class PlayState extends MusicBeatState
daNote.destroy();
}

daNote.y = (strumLine.y - (Conductor.songPosition - daNote.strumTime) * (0.45 * FlxMath.roundDecimal(PlayState.SONG.speed, 2)));

// WIP interpolation shit? Need to fix the pause issue
// daNote.y = (strumLine.y - (songTime - daNote.strumTime) * (0.45 * PlayState.SONG.speed));

if (daNote.y < -daNote.height)
{
if (daNote.tooLate || !daNote.wasGoodHit)
if (daNote.isSustainNote && daNote.wasGoodHit)
{
health -= 0.0475;
vocals.volume = 0;
daNote.kill();
notes.remove(daNote, true);
daNote.destroy();
}
else
{
if (daNote.tooLate || !daNote.wasGoodHit)
{
health -= 0.0475;
vocals.volume = 0;
}

daNote.active = false;
daNote.visible = false;
daNote.active = false;
daNote.visible = false;

daNote.kill();
notes.remove(daNote, true);
daNote.destroy();
daNote.kill();
notes.remove(daNote, true);
daNote.destroy();
}
}
});
}
Expand Down Expand Up @@ -1934,18 +1955,18 @@ class PlayState extends MusicBeatState
switch (daNote.noteData)
{
// NOTES YOU ARE HOLDING
case 0:
if (left)
goodNoteHit(daNote);
case 1:
if (down)
goodNoteHit(daNote);
case 2:
if (up)
goodNoteHit(daNote);
case 3:
if (right)
goodNoteHit(daNote);
case 1:
if (down)
goodNoteHit(daNote);
case 0:
if (left)
goodNoteHit(daNote);
}
}
});
Expand All @@ -1963,6 +1984,16 @@ class PlayState extends MusicBeatState
{
switch (spr.ID)
{
case 0:
if (leftP && spr.animation.curAnim.name != 'confirm')
spr.animation.play('pressed');
if (leftR)
spr.animation.play('static');
case 1:
if (downP && spr.animation.curAnim.name != 'confirm')
spr.animation.play('pressed');
if (downR)
spr.animation.play('static');
case 2:
if (upP && spr.animation.curAnim.name != 'confirm')
spr.animation.play('pressed');
Expand All @@ -1973,16 +2004,6 @@ class PlayState extends MusicBeatState
spr.animation.play('pressed');
if (rightR)
spr.animation.play('static');
case 1:
if (downP && spr.animation.curAnim.name != 'confirm')
spr.animation.play('pressed');
if (downR)
spr.animation.play('static');
case 0:
if (leftP && spr.animation.curAnim.name != 'confirm')
spr.animation.play('pressed');
if (leftR)
spr.animation.play('static');
}

if (spr.animation.curAnim.name == 'confirm' && !curStage.startsWith('school'))
Expand Down Expand Up @@ -2023,14 +2044,14 @@ class PlayState extends MusicBeatState

switch (direction)
{
case 0:
boyfriend.playAnim('singLEFTmiss', true);
case 1:
boyfriend.playAnim('singDOWNmiss', true);
case 2:
boyfriend.playAnim('singUPmiss', true);
case 3:
boyfriend.playAnim('singRIGHTmiss', true);
case 1:
boyfriend.playAnim('singDOWNmiss', true);
case 0:
boyfriend.playAnim('singLEFTmiss', true);
}
}
}
Expand All @@ -2046,12 +2067,12 @@ class PlayState extends MusicBeatState

if (leftP)
noteMiss(0);
if (downP)
noteMiss(1);
if (upP)
noteMiss(2);
if (rightP)
noteMiss(3);
if (downP)
noteMiss(1);
}

function noteCheck(keyP:Bool, note:Note):Void
Expand Down Expand Up @@ -2081,14 +2102,14 @@ class PlayState extends MusicBeatState

switch (note.noteData)
{
case 0:
boyfriend.playAnim('singLEFT', true);
case 1:
boyfriend.playAnim('singDOWN', true);
case 2:
boyfriend.playAnim('singUP', true);
case 3:
boyfriend.playAnim('singRIGHT', true);
case 1:
boyfriend.playAnim('singDOWN', true);
case 0:
boyfriend.playAnim('singLEFT', true);
}

playerStrums.forEach(function(spr:FlxSprite)
Expand All @@ -2102,9 +2123,12 @@ class PlayState extends MusicBeatState
note.wasGoodHit = true;
vocals.volume = 1;

note.kill();
notes.remove(note, true);
note.destroy();
if (!note.isSustainNote)
{
note.kill();
notes.remove(note, true);
note.destroy();
}
}
}

Expand Down