highscore

Setting Up HighScore in Swift and Sprite Kit using NSuserdefaults

匿名 (未验证) 提交于 2019-12-03 02:50:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am building a swift game and a need to set up a highscore , i have been trying to figure out how to do it for a while. So please can you tell me how to search this library to see if there is a already saved high score and then compare it to the user's score. I have tried coming out with this but it won't work. Please Help and be as clear as possible. Giving me example code would be extremely appreciated. if let highscore: AnyObject = NSUserDefaults.valueForKey("highscore") { var savedScore: Int = NSUserDefaults.standardUserDefaults()