Skip to Main Content
Learning iPhone Game Development with Cocos2D 3.0
book

Learning iPhone Game Development with Cocos2D 3.0

by Kirill Muzykov
June 2014
Beginner to intermediate content levelBeginner to intermediate
434 pages
9h 49m
English
Packt Publishing
Content preview from Learning iPhone Game Development with Cocos2D 3.0

Time for action – using the text field

What's the purpose of the highscores table if you can't beat any of the highscores? Let's change that and replace the test data with the actual highscores. To do this, we're going to need the player to enter their name when they beat a highscore:

  1. Create a new Objective-C class in the Common group. Name the class HighscoreManager and make it a subclass of NSObject.
  2. Open the HighscoreManager.h file and replace its contents with the following code:
    #import "GameStats.h"
    
    #define kMaxHighscores 5
    
    @interface HighscoreManager: NSObject
    
    -(NSArray *)getHighScores;
    
    -(BOOL)isHighscore:(int)score;
    
    -(void)addHighScore:(GameStats *)newHighscore;
    
    +(HighscoreManager *)sharedHighscoreManager;
    
    @end
  3. Then, open the HighscoreManager.h ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Beginning Swift Games Development for iOS: Develop 2D and 3D games Using Apple's SceneKit and SpriteKit

Beginning Swift Games Development for iOS: Develop 2D and 3D games Using Apple's SceneKit and SpriteKit

James Goodwill, Wesley Matlock

Publisher Resources

ISBN: 9781782160144Supplemental Content