Skip to content

Instantly share code, notes, and snippets.

@EliteIntegrity
Created March 5, 2019 11:50
Show Gist options
  • Save EliteIntegrity/b351cc9bf61300f64835e688740546dc to your computer and use it in GitHub Desktop.
Save EliteIntegrity/b351cc9bf61300f64835e688740546dc to your computer and use it in GitHub Desktop.
Add the menacePlayer function to the KotlinInvadersView class.
private fun menacePlayer() {
if (uhOrOh) {
// Play Uh
soundPlayer.playSound(SoundPlayer.uhID)
} else {
// Play Oh
soundPlayer.playSound(SoundPlayer.ohID)
}
// Reset the last menace time
lastMenaceTime = System.currentTimeMillis()
// Alter value of uhOrOh
uhOrOh = !uhOrOh
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment