views:

52

answers:

1

I am new to objective-c and am having trouble figuring out a way to store points for multiple players in my game. I have 4 characters in my game that are all objects from the same class. 1 is controlled by the user and the other 3 are controlled by the computer. Each level in my game consists of 3 races. I need a way to keep track of each characters finish place for each round so that at the end of the 3 races, I can award points to the user depending on which place they came in. Can anyone offer a suggestion? Would a NSDictionary accomplish this? I kind of have a very rough understanding of NSDictionary but wasn't sure if I could filter out each player's data to get just their data. In my mind, I think I need somewhere to store this data so then I can get the average of their finishes to compare to the other players.

+2  A: 

why wouldn't you simply define an array which holds the players score for each level as an instance variable of the Player class? So for example:

@interface Player : NSObject {
NSArray *scoreForLevel;
}
ennuikiller
Well at the end of each round I was hoping to show a summary of each players' placement. That I know would just be an array sorted by placement. I guess I could have 1 array to give the round summary and also store the scores in each player's object in another array.I think you put me on the right track.
SonnyBurnette
Glad to have helped out!
ennuikiller