High Scores

ChrisPol
Unregistered
 
Post: #1
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?
Quote this message in a reply
Moderator
Posts: 3,554
Joined: 2003.06
Post: #2
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.
Quote this message in a reply
ChrisPol
Unregistered
 
Post: #3
Thanks for the suggestion. It worked very nicely...

I decided to encode the scores to the Library/ApplicationSupport folder rather than write them into the standard defaults database.
Quote this message in a reply
Post Reply 

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,696 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