Instantly share code, notes, and snippets.

@MarcinusX MarcinusX/main.dart Secret
Last active Jan 14, 2019

Embed
What would you like to do?
@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