diff --git a/source/funkin/play/PlayState.hx b/source/funkin/play/PlayState.hx index ff5b924f8..e458dbabf 100644 --- a/source/funkin/play/PlayState.hx +++ b/source/funkin/play/PlayState.hx @@ -639,6 +639,9 @@ class PlayState extends MusicBeatState currentStage.resetStage(); + playerStrumline.clean(); + opponentStrumline.clean(); + // Delete all notes and reset the arrays. regenNoteData(); diff --git a/source/funkin/play/notes/Strumline.hx b/source/funkin/play/notes/Strumline.hx index 4fdf5afe3..85ac8b2ff 100644 --- a/source/funkin/play/notes/Strumline.hx +++ b/source/funkin/play/notes/Strumline.hx @@ -396,6 +396,38 @@ class Strumline extends FlxSpriteGroup return heldKeys[dir]; } + /** + * Called when the song is reset. + * Removes any special animations and the like. + * Doesn't reset the notes from the chart, that's handled by the PlayState. + */ + public function clean():Void + { + for (note in notes.members) + { + if (note == null) continue; + killNote(note); + } + + for (holdNote in holdNotes.members) + { + if (holdNote == null) continue; + holdNote.kill(); + } + + for (splash in noteSplashes) + { + if (splash == null) continue; + splash.kill(); + } + + for (cover in noteHoldCovers) + { + if (cover == null) continue; + cover.kill(); + } + } + public function applyNoteData(data:Array):Void { this.notes.clear(); @@ -423,6 +455,7 @@ class Strumline extends FlxSpriteGroup public function killNote(note:NoteSprite):Void { + if (note == null) return; note.visible = false; notes.remove(note, false); note.kill(); diff --git a/source/funkin/play/notes/SustainTrail.hx b/source/funkin/play/notes/SustainTrail.hx index d9f1aab6e..9a2265bdc 100644 --- a/source/funkin/play/notes/SustainTrail.hx +++ b/source/funkin/play/notes/SustainTrail.hx @@ -282,6 +282,20 @@ class SustainTrail extends FlxSprite missedNote = false; } + public override function revive():Void + { + super.revive(); + + strumTime = 0; + noteDirection = 0; + sustainLength = 0; + fullSustainLength = 0; + noteData = null; + + hitNote = false; + missedNote = false; + } + override public function destroy():Void { vertices = null;