Im having a big trouble with Cocos2d 2.0 version =(
the problem: after launch the app, my gamescene doesnt go up the screen, there is a hell black screen, whatever I do.
Here go a stretch from my code.
I`ll appreciate if you guys try to help me =D
Thanks!
//AppDelegate from cocos2d basic template, I change this line
[director_ pushScene:[GameScene node]];
//my GameScene class implementation
- (id)init
{
if(self != nil)
{
BackgroundLayer *backgroundLayer = [BackgroundLayer node];
[self addChild:backgroundLayer z:0];
}
return self;
}
//then, my BackgroundLayer class implementation
- (id)init
{
if(self != nil)
{
CCSprite *backgroundImage = [CCSprite spriteWithFile:@"backgroundiPhone.png"];
CGSize screenSize = [[CCDirector sharedDirector] winSize];
[backgroundImage setPosition:CGPointMake(screenSize.width / 2, screenSize.height / 2)];
//yea the image is in the project, maybe if I add some color at the sprite to be sure?
[self addChild:backgroundImage z:0 tag:0];
}
return self;
}
Why don’t you call parent’s
initinside yourinitmethod? Add this line to the beginning of your init method.