diff --git a/Twinmoji/ContentView.swift b/Twinmoji/ContentView.swift index 3555cc0..2ecc251 100644 --- a/Twinmoji/ContentView.swift +++ b/Twinmoji/ContentView.swift @@ -109,7 +109,8 @@ struct ContentView: View { runClock() } - func timeOut() { + func timeOut(for emoji: [String]) { + guard currentEmoji == emoji else { return } if gameState == .player1Answering { player1Score -= 1 } else if gameState == .player2Answering { @@ -121,11 +122,11 @@ struct ContentView: View { func runClock() { answerScale = 1 - + let checkEmoji = currentEmoji withAnimation(.linear(duration: answerTime)) { answerScale = 0 } completion: { - timeOut() + timeOut(for: checkEmoji) } }