I am trying to initialize a scene in cocos2d (version 0.99.5) and want to pass a parameter. In this case, the parameter is an int value corresponding to the level number. The scene class itself is a subclass of CCLayer
, and I initialize it using the node class method:
GameScene *scene = [GameScene node]; //GameScene subclass of CCLayer
I have my own initialization method, which accepts the variable "level" as follows:
- (id) initWithGameLevel:(int)level { if ((self = [super init])){
Just curious: I'm not at the heart of my approach in creating my own initWi method, thanks, and how to initialize a scene using an integer?
source share