2012-11-20 70 views
1

林具有cocos2d的2.0版本=(的Cocos2D 2.0黑屏ccscene

問題的一個大麻煩:啓動應用程序後,我gamescene犯規上去的屏幕,有一個地獄黑屏,無論我做什麼。

這裏走一氣從我的代碼。如果你們儘量幫我= d 感謝

我心底感激!

//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; 
} 

回答

1

你爲什麼不CAL升母公司initinit方法裏面?將此行添加到init方法的開頭。

self = [super init]; 
+0

OMG!我忘了完全= S非常感謝你 –

+0

歡迎你=) – Morion

相關問題