High Scores
I'm writing a puzzle game that needs to store the top three high scores. I wanted to get some thoughts on the process I'm considering...
Create a HighScore class with instance variables like the player's name, the score and the date it was set.
Create a mutable array of the HighScore class with three HighScore objects and get the old ones out of the user defaults. Change the scores stored in
the array when needed.
Write the NSMutableArray to the user defaults directory.
Is it practical to do it this way with my AppController or is there an easier model I'm missing?
Create a HighScore class with instance variables like the player's name, the score and the date it was set.
Create a mutable array of the HighScore class with three HighScore objects and get the old ones out of the user defaults. Change the scores stored in
the array when needed.
Write the NSMutableArray to the user defaults directory.
Is it practical to do it this way with my AppController or is there an easier model I'm missing?
I'd create a HighScores class which contains an NSMutableArray of NSMutableDictionaries called highScores. Each dictionary in the array of highScores can have "name", "score" and "date" keys. Sort as needed.
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| High Scores | kodex | 0 | 1,883 |
Aug 1, 2005 04:39 PM Last Post: kodex |
|
| Saving High Scores | Nick | 7 | 3,695 |
Jun 20, 2005 12:08 AM Last Post: Malarkey |
|
| High Scores in Cocoa | BeyondCloister | 17 | 6,230 |
Apr 25, 2003 03:58 AM Last Post: OneSadCookie |
|

