-
-
Save MarcinusX/567d40768024e6b1a0089ddd5b9fc3b9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@override | |
void initState() { | |
super.initState(); | |
animationController = AnimationController(vsync: this, duration: Duration(milliseconds: 300)); | |
animationController.addStatusListener((status) { | |
if (status == AnimationStatus.completed && isPlaying) { //<-- Add this check | |
if (notes[currentNoteIndex].state != NoteState.tapped) { //<--Add this check | |
//game over | |
setState(() { | |
isPlaying = false; //<--Stop the game | |
}); | |
} else if (currentNoteIndex == notes.length - 5) { | |
//song finished | |
} else { | |
setState(() => ++currentNoteIndex); | |
animationController.forward(from: 0); | |
} | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment