Let me preface that my game is technically running fine and there are no errors or warnings during compile, but I started researching into why I have such a long pause while the game is loading and I have come across what appears to me to be a bizarre behavior that I'm hoping someone can shed some light on.
I started with the framework from Monocle Studios whitepaper. I have a MenuScene and a GameScene (and a couple others).
in my MenuScene, I have:
-(void) startGame: (id) sender
{
//start the game
[[SimpleAudioEngine sharedEngine] playEffect:@"button.wav"];
GameScene *gs = [GameScene node];
[[Director sharedDirector] replaceScene:gs ];
}
and at the beginning of GameScene, I have:
@implementation GameScene
-(id) init {
self = [super init];
if(self != nil) {
Sprite *main = [Sprite spriteWithFile:@"MAIN_TITLE.jpg"];
[main setPosition:ccp(240,160)];
[self addChild:main z:0];
[self addChild:[GameLayer node] z:1];
}
return self;
}
@end
@implementation GameLayer
-(id) init
{
...
}
Pretty old hat. What is bizarre is that the image in the GameScene Implementation does not load when I'm also calling the GameLayer below it.
if I comment out [self addChild:[GameLayer node] z:1];, the image loads properly. It doesnt get covered over by anything else, it just doesnt load and the menu from the previous Scene stays on the screen until the init{} method is finished in GameLayer.
To add insult to injury, I have almost the identical system in MenuScene with an image on z:0 and a MenuLayer on z:1 and that image loads perfectly.
any ideas?