Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6593165
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T17:38:50+00:00 2026-05-25T17:38:50+00:00

I recently followed Ray Wenderlich’s Cocos2D tutorial for putting Cocos2D in a UIKit app.

  • 0

I recently followed Ray Wenderlich’s Cocos2D tutorial for putting Cocos2D in a UIKit app. I am currently only using Cocos2D in only one of my UIViews. In the tutorial he uses a CCScene which is a specific .h and .m class in the project. In the scene is some code which I do not know the important of either. I must say that I am new to Cocos2D and I am wondering what is the point of a CCScene? Do I need to use it in my situation? And if so, how?

Thanks!

Edit1: Is this correct? I am also adding a simple game loop so should I do it in the way I am doing it below or should I use CADisplayLink?

//Cocos2D methods
-(id) init {
    if((self=[super init]))
    {
        CCScene *scene = [CCScene node];
        CCLayer *layer = [CCLayer node];
        [scene addChild:layer];
        [[CCDirector sharedDirector] runWithScene:scene];
        [self performSelector:@selector(cocosgameLoop:) withObject:nil afterDelay:1/60.0f];
    }
    return self;
}
- (void)cocosgameLoop:(ccTime)dT {
    //Check for collisions here and add gravity, etc....
}
- (void)viewDidUnload {
    [super viewDidUnload];
    [[CCDirector sharedDirector] end];
}
//
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T17:38:50+00:00Added an answer on May 25, 2026 at 5:38 pm

    CCScene is a root node in a scene graph. A node that have no parents. CCDirector operates with CCScenes only. Read this for more information: http://www.cocos2d-iphone.org/wiki/doku.php/prog_guide:lesson_3._menus_and_scenes

    ANSWER TO YOUR COMMENT

    Actually you don’t have to understand how CCScene is implemented. But if you want something to be rendered with cocos2d you have to create a CCScene and pass it to CCDirector. The common way is:

    CCScene *scene = [CCScene node];
    CCLayer *layer = [CCLayer node];
    [scene addChild:layer];
    [[CCDirector sharedDirector] runWithScene:scene];
    

    Usually you have to subclass a CCLayer and reimplement init method to add your staff (sprites for example). Take a look at programming guide for more more detailed answer:
    http://www.cocos2d-iphone.org/wiki/doku.php/prog_guide:index

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I recently followed a small tutorial on howto install apache on a systems where
Right, hi guys, I recently followed a tutorial http://xnadevelopment.com/tutorials/thestateofthings/thestateofthings.shtml where I wanted to create
FireWatir I recently started using Firewatir for testing, I followed all the required steps
Using CKeditor on my project. Recently installed fmath plug-in . Followed all instruction and
I'm writing an iPhone application using Monotouch and recently the app has started crashing
I recently followed this tutorial on Google Cloud SQL and GWT: http://code.google.com/apis/sql/docs/developers_guide_java.html I deployed
I have recently upgraded an app from Rails 3.0 to 3.1. I have followed
I recently set up a new account with github. I'm following a Rails tutorial
I've found today that my recently published app on the Android Market, is not
I recently followed a discussion on the Qt4-interest mailing list about whether it is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.