У меня есть стрельба персонажа, и я хочу, чтобы он снимал только при касании экрана, я продолжаю получать эту ошибку. «GameScene» не имеет члена с именем «stimer» вот кодКак остановить NSTimer
override func touchesBegan(touches: Set<NSObject>, withEvent event: UIEvent) {
/* Called when a touch begins */
for touch: AnyObject in touches {
var stimer = NSTimer.scheduledTimerWithTimeInterval(0.5, target: self, selector: Selector("spawnShot"), userInfo: nil, repeats: true)
let location = touch.locationInNode(self)
player.position.x = location.x
}
}
override func touchesEnded(touches: Set<NSObject>, withEvent: UIEvent){
for touch: AnyObject in touches{
if self.stimer.valid{
self.timer.invalidate()
self.timer = nil
}
}
}