diff --git a/source/funkin/NoteSplash.hx b/source/funkin/NoteSplash.hx index 318ef8f9f..81b35b36d 100644 --- a/source/funkin/NoteSplash.hx +++ b/source/funkin/NoteSplash.hx @@ -24,6 +24,16 @@ class NoteSplash extends FlxSprite // alpha = 0.75; } + public override function update(elapsed:Float):Void + { + super.update(elapsed); + + if (animation.finished) + { + kill(); + } + } + public static function buildSplashFrames(force:Bool = false):FlxAtlasFrames { // static variables inside functions are a cool of Haxe 4.3.0. diff --git a/source/funkin/play/PlayState.hx b/source/funkin/play/PlayState.hx index 0c4c1abfb..c407203f6 100644 --- a/source/funkin/play/PlayState.hx +++ b/source/funkin/play/PlayState.hx @@ -33,6 +33,7 @@ import funkin.play.event.SongEventData.SongEventParser; import funkin.play.notes.NoteSprite; import funkin.play.notes.NoteDirection; import funkin.play.notes.Strumline; +import funkin.play.notes.SustainTrail; import funkin.play.scoring.Scoring; import funkin.play.song.Song; import funkin.play.song.SongData.SongDataParser; @@ -1728,10 +1729,15 @@ class PlayState extends MusicBeatState // This handles scoring so we don't need it on the opponent's side. for (holdNote in playerStrumline.holdNotes.members) { + if (holdNote == null || !holdNote.alive) continue; + // While the hold note is being hit, and there is length on the hold note... - if (holdNote.hitNote && holdNote.sustainLength > 0) + if (holdNote.hitNote && !holdNote.missedNote && holdNote.sustainLength > 0) { // Grant the player health. + trace(holdNote); + trace(holdNote.noteData); + trace(holdNote.sustainLength); health += Constants.HEALTH_HOLD_BONUS_PER_SECOND * elapsed; } } @@ -1760,6 +1766,7 @@ class PlayState extends MusicBeatState // Generate a list of notes within range. var notesInRange:Array = playerStrumline.getNotesMayHit(); + var holdNotesInRange:Array = playerStrumline.getHoldNotesHitOrMissed(); // If there are notes in range, pressing a key will cause a ghost miss. @@ -1785,7 +1792,7 @@ class PlayState extends MusicBeatState // Play the strumline animation. playerStrumline.playPress(input.noteDirection); } - else if (Constants.GHOST_TAPPING && notesInRange.length > 0 && notesInDirection.length == 0) + else if (Constants.GHOST_TAPPING && (holdNotesInRange.length + notesInRange.length > 0) && notesInDirection.length == 0) { // Pressed a wrong key with no notes nearby AND with notes in a different direction available. // Perform a ghost miss (anti-spam). diff --git a/source/funkin/play/notes/Strumline.hx b/source/funkin/play/notes/Strumline.hx index 77b039712..0edc4435a 100644 --- a/source/funkin/play/notes/Strumline.hx +++ b/source/funkin/play/notes/Strumline.hx @@ -130,6 +130,13 @@ class Strumline extends FlxSpriteGroup }); } + public function getHoldNotesHitOrMissed():Array + { + return holdNotes.members.filter(function(holdNote:SustainTrail) { + return holdNote != null && holdNote.alive && (holdNote.hitNote || holdNote.missedNote); + }); + } + public function getHoldNotesInRange(strumTime:Float, hitWindow:Float):Array { var hitWindowStart:Float = strumTime - hitWindow; @@ -255,15 +262,17 @@ class Strumline extends FlxSpriteGroup else if (holdNote.hitNote && holdNote.sustainLength <= 0) { // Hold note is completed, kill it. - playStatic(holdNote.noteDirection); + if (isKeyHeld(holdNote.noteDirection)) + { + playPress(holdNote.noteDirection); + } + else + { + playStatic(holdNote.noteDirection); + } holdNote.visible = false; holdNote.kill(); } - else if (holdNote.hitNote && holdNote.sustainLength <= 10) - { - // TODO: Better handle the weird edge case where the hold note is almost completed. - holdNote.visible = false; - } else if (holdNote.missedNote && (holdNote.fullSustainLength > holdNote.sustainLength)) { // Hold note was dropped before completing, keep it in its clipped state. @@ -294,6 +303,11 @@ class Strumline extends FlxSpriteGroup holdNote.sustainLength = (holdNote.strumTime + holdNote.fullSustainLength) - Conductor.songPosition; + if (holdNote.sustainLength <= 10) + { + holdNote.visible = false; + } + if (PreferencesMenu.getPref('downscroll')) { holdNote.y = this.y - holdNote.height + STRUMLINE_SIZE / 2;