Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Mastering Cocos2d Cross-Platform Game Development
  • Table Of Contents Toc
  • Feedback & Rating feedback
Mastering Cocos2d Cross-Platform Game Development

Mastering Cocos2d Cross-Platform Game Development

By : Alex Ogorek
4.5 (4)
close
close
Mastering Cocos2d Cross-Platform Game Development

Mastering Cocos2d Cross-Platform Game Development

4.5 (4)
By: Alex Ogorek

Overview of this book

If you are a developer who is experienced with Cocos2d and Objective-C, and want to take your game development skills to the next level, this book is going to help you achieve your goal.
Table of Contents (10 chapters)
close
close
9
Index

Getting a scene up and running


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.

Creating the initial code for the scene to open

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;
@end

Then, 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]))
  {
...
Visually different images
CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Mastering Cocos2d Cross-Platform Game Development
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon