2011-12-03 46 views
0

我正在cocos2d.I中的應用程序想要在我的應用程序中使用增強現實,所以我已經添加了應用程序委託中的相機覆蓋的代碼並在我的場景中使用它。但問題是我想用它運行time.My代碼,我在場景中添加背景。我想使用相機覆蓋作爲背景點擊事件

@implementation gameSceneDarkRedBeads 

@synthesize window; 
- (id) init { 

self = [super init]; 
appDel=(iChessAppDelegate *)[[UIApplication sharedApplication] delegate]; 
appDel.overlay.hidden=YES; 


if (self != nil) { 

    CCSprite * bg = [CCSprite spriteWithFile:@"green_bg.png"]; 
    bg.anchorPoint = CGPointMake(0,0); 
    [self addChild:bg z:0]; 
    [self addChild:[gameSceneDarkRedBeadsLayer node] z:1]; 
} 
return self; 

}

這上面,我是躲在overlay.But我想我的CCSprite改變爲透明圖像上單擊事件,並顯示overlay.Here我加入我的層精靈。

@implementation gameSceneDarkRedBeadsLayer 

-(id)init 

{ 

self.isAccelerometerEnabled = YES; 

if((self=[super init])) { 

    [[SimpleAudioEngine sharedEngine] setEffectsVolume:0.0f]; 
    [[SimpleAudioEngine sharedEngine] playEffect:@"KompoloiA.mp3"]; 

    self.isTouchEnabled = YES; 

..........

請幫我在哪裏可以定義顯示和隱藏CCSprite並顯示相機視圖的方法。

謝謝,

回答