Search code examples
objective-ccocos2d-iphonekobold2d

Error in config.lua class not inherit from CCScene


I am getting the following error on my iPhone.

ERROR in config.lua

FirstSceneClassName = 'Level1'

This class does not exist or does not inherit from CCScene!

What am I doing wrong? It worked last time I was working on this code last week.

config.lua

FirstSceneClassName = "Level1",

Level1.h

#import "kobold2d.h"
@interface Level1: CCLayer
{
}
@end

Level1.m

#import "Level1.h"
#import "HUDLayer.h"

@interface Level1 (PrivateMethods)
@end

@implementation Level1

@synthesize theMap, bgLayer, Player;

+(id) scene
{
    CCScene *scene = [CCScene node];

    HudLayer *HUD = [HudLayer node];
    [scene addChild:HUD z:2];

    Level1 *layer = [Level1 node];
    [scene addChild:layer];

    return scene;
}

- (id)init
{
    self = [super init];
    if (self != nil) {

        }

    return self;
}
@end

Solution

  • Finally found by I'm getting this error and thought I'd share for any other new Kobold2D and Cocos2D users.

    I forgot to add my Level.m file to the Compile Sources located: Target App > Build Phases > Compile Sources > Plus Button.

    Hope this helps others.