title: Cocos2d How to Switch Scenes
body: <p>How do i switch scenes in cocos2d? I have my main class, "HellowWorldLayer.h/.m" , but i can't seem to switch scenes correctly. I have tried :</p>
  
  <pre><code>[[CCDirector sharedDirector] replaceScene:[Race node]];
  //And
  [[CCDirector sharedDirector] replaceScene:[Race Scene]];
  </code></pre>
  
  <p>I put a break point in and i can see it is going to the new scene but the Button i added to the new scene isn't showing up. I am creating the button correctly. Then i am adding it to the screen in the new scene like this:</p>
  
  <pre><code> [self addChild:Menu];
  </code></pre>
  
  <p>I just took all of the code from HolloWorldLayer.m/.h and copied it into the new scene (class) but i am unable to transition correctly. I am new to xcode and cocos2d so sorry if this is really simple.           </p>
  
  <p>Race.m</p>
  
  <pre><code>#import "Race.h"
  #import "Intermediary.h"
  
  @implementation Race
  
  
  +(CCScene *) scene{
      // 'scene' is an autorelease object.
      CCScene *scene = [CCScene node];
  
      // 'layer' is an autorelease object.
      Race *layer = [Race node];
  
      // add layer as a child to scene
      [scene addChild: layer];
  
      // return the scene
      return scene;
  }
  
  -(id) init{
  
      if( (self=[super init]) ) {
  
          NSLog(@"Racing!");
          CCLabelTTF *startLbl = [CCLabelTTF labelWithString:@"Start" fontName:@"Marker Felt" fontSize:20];
          CCMenuItemLabel *startMenu = [CCMenuItemLabel itemWithLabel:startLbl block:^(id sender) {
              NSLog(@"I have been pushed!");
          }];
          startMenu.position = ccp(50,50);
          CCMenu *Menu = [CCMenu menuWithItems:startMenu, nil];
          [self addChild:Menu];
  
  
      }
      return self;
  }
  
  
  @end
  </code></pre>