2012-11-20 4 views
1

임 : 시작 응용 프로그램 후, 내 gamescene 화면을 이동 나던, 내가 어떤 지옥 검은 화면이 있습니다. 여기 적인 Cocos2D 2.0 검은 화면 ccscene

내 코드에서 스트레칭을 이동합니다. 너희들은 D = 감사를 도와하려고하면

이 감사 I`ll!

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

왜 그렇죠 칼 부모님 initinit 방법 안에 있습니까? 이 행을 init 메소드의 처음에 추가하십시오.

self = [super init]; 
+0

OMG !!! 나는 그것을 완전히 잊었습니다 = s 고맙습니다. –

+0

당신은 =) – Morion