-1
\$\begingroup\$

so I want to increment my score by 100 every 0.25 seconds, this is what I have so far and it's not working at all!

        let scoreDisplay = UILabel()
    scoreDisplay.text = "Score: \(self.score)"
    scoreDisplay.textColor = UIColor.red
    scoreDisplay.frame = CGRect(x: mainWidth / 2 - 200, y: mainHeight - 400, width: 247, height: 100)
    self.view.addSubview(scoreDisplay)


    let delay = SKAction.wait(forDuration: 0.25)
    let incrementScore = SKAction.run ({
        self.score = self.score + 100
        scoreDisplay.text = "\(self.score)"
    })

What could be the issue? Could you provide some code that would fix my issue?

\$\endgroup\$
  • \$\begingroup\$ What are the specific symptoms of "not working at all"? This could describe everything from the application running but with no scoring updates / incorrect numbers in your scoring updates, to a compiler or runtime error that prevents you from running the app at all, to your OS crashing or your computer catching fire. Being specific about what you're observing can help track down the issue. \$\endgroup\$ – DMGregory Jan 11 at 17:06

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.