objective c - I would like the awarded gems (high score) to represent one gem per every ten points scored -
this must simple compared rest of work.
essential have point system have score gameplay , have score gems. scored 50 points during round. want gems 1 point every 10 points scored during each round, in case gems 5 points.
then having trouble figuring out how add new points gems rather replacing them high score would. example, after receiving 5 gems (stated above) play round , score 80 points, equals 8 gems. have 13 gems (5+8) rather 8 because new high amount.
thank help!
-(void)incrementpoints { if (!gameovergame) { score++; [self runaction:scoresound]; sklabelnode *scorenode = (sklabelnode *)[self childnodewithname:kpointsname]; nsstring *scorestring; scorestring = [nsstring stringwithformat:@"%i", score]; scorenode.text = scorestring; -(void)deletescores{ [self enumeratechildnodeswithname:kscoreboardrupeenodename usingblock:^(sknode *node,bool *stop){ [node removefromparent]; }]; if(score == a*10){ highscore = a; [[appuserdefaults sharedappuserdefaults]sethihgscore:(int)score + highscore]; viewcontroller * viewcontroller = (viewcontroller *) self.view.window.rootviewcontroller; [viewcontroller submittoleaderboard:(int)score]; } scoreboardnode = [gameobjects scoreboardwithscore:(int)score andhighscore:(int)highscore]; [self addchild:scoreboardnode]; [self enumeratechildnodeswithname:kpointsname usingblock:^(sknode *node,bool *stop){ [node removefromparent]; }]; [self die];
}
simply keep track of score points , if 1 gem == 10 points, that's presentation issue; i.e. rather displaying 85 points "85" draw 8 gems. i.e.
nsinteger numberofgemstodraw = self.pointsscored / 10;
note self.pointsscored
saved using nsuserdefaults
, within game center. it's score-related data care about.
also note remaining points (i.e. self.pointsscored % 10
) used draw semi-complete gems, user has idea of how close next complete gem.
tl;dr store points , display gems.
Comments
Post a Comment