From 7a701826974693c17946fc49ca7b14c1b576c91a Mon Sep 17 00:00:00 2001 From: MtH Date: Sat, 13 Feb 2021 23:39:31 +0100 Subject: [PATCH 1/2] better sustain notes & organizing --- source/Note.hx | 40 +++--------- source/PlayState.hx | 150 +++++++++++++++++++++++++------------------- 2 files changed, 94 insertions(+), 96 deletions(-) diff --git a/source/Note.hx b/source/Note.hx index 32e1b5c18..2b04b5985 100644 --- a/source/Note.hx +++ b/source/Note.hx @@ -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]); @@ -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(); } } diff --git a/source/PlayState.hx b/source/PlayState.hx index cb4f4876b..89efc8bd3 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -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]); @@ -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: @@ -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'); @@ -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); } } @@ -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') @@ -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; @@ -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(); + } } }); } @@ -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); } } }); @@ -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'); @@ -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')) @@ -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); } } } @@ -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 @@ -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) @@ -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(); + } } } From 76a3bd9b0e232c2d2b88f8a072622579acea200c Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Sat, 13 Feb 2021 18:10:52 -0500 Subject: [PATCH 2/2] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 85f61e9a0..0cf2241d1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Made the transitions between the story mode levels more seamless. ### Fixed - Chart's and chart editor now support changeBPM, GOD BLESS MTH FOR THIS ONE I BEEN STRUGGLIN WIT THAT SINCE OCTOBER LMAO ([GOD BLESS MTH](https://github.com/ninjamuffin99/Funkin/pull/382)) +- Fixed sustain note trails ALSO THANKS TO MTH U A REAL ONE ([MTH VERY POWERFUL](https://github.com/ninjamuffin99/Funkin/pull/415)) - Antialiasing on the skyscraper lights ## [0.2.7] - 2021-02-02