O'Reilly logo

Cocos2d for iPhone 0.99 Beginner's Guide by Pablo Ruiz

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action - first time tutorials

We will start by creating the Tutorial class, which will display a message on the centre of the screen. This message can be in any text you want and can be displayed any time you want to display it. Once the player has read it, he can dismiss it by touching it.

  1. The following is the Tutorial.h file:
    #import <Foundation/Foundation.h> #import "cocos2d.h" #import "GameScene.h" @interface Tutorial : CCNode { GameLayer * theGame; touchState state; CCSprite * back; CCLabel * label; } @property(readwrite,nonatomic) touchState state; @property(nonatomic,retain) GameLayer * theGame; @property(nonatomic,retain) CCSprite * back; @property(nonatomic,retain) CCLabel * label; -(id)initWithText:(NSString *)text theGame:(GameLayer ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required