I have looked around at many articles, but none of them seem to make sense or are relevant to my issue. I want to give the user a set time to press a node. If they succeed in pressing the node within the set time the timer should reset, if they fail to press the node within the set time it will be game over.
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
let touch = touches.first!
if square.contains(touch.location(in: self)) {
moveSquare()
GameScene.score+=1
scoreLabel.text = "\(GameScene.score)"
}
} else {
gameOverScene()
}
}
so my question is how do I set the timer up to achieve those requirements, and where do I put the code?