-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
Mastering Cocos2d Cross-Platform Game Development
By :
Before we even start adding anything to the screen, we need to make sure we have a game that can be viewed on our device or a simulator. Once you've created the project in SpriteBuilder (or gotten the blank project that was listed earlier) and opened the project in Xcode, go to the next step.
You should see a file called MainScene.h and another file called MainScene.m. Open the header file (which has the .h extension).
In the header file, add a few lines of code between the @interface line and the @end line. The header should look like this:
@interface MainScene : CCNode
{
CGSize winSize;
}
+(CCScene*)scene;
@endThen, in the main file (which has the .m extension), some lines of code should be added between the @implementation and @end lines. It should look as follows:
#import "MainScene.h"
@implementation MainScene
+(CCScene *)scene
{
return [[self alloc] init];
}
-(id)init
{
if ((self=[super init]))
{
...
Change the font size
Change margin width
Change background colour