Cocos2d iphone 我想使用相机覆盖作为点击事件的背景

Cocos2d iphone 我想使用相机覆盖作为点击事件的背景,cocos2d-iphone,Cocos2d Iphone,我正在cocos2d中制作应用程序。我想在我的应用程序中使用增强现实,因此我已经在应用程序代理中添加了摄影机覆盖的代码,并在我的场景中使用它。但问题是,我想在运行时使用它。我在场景中添加背景的代码 @implementation gameSceneDarkRedBeads @synthesize window; - (id) init { self = [super init]; appDel=(iChessAppDelegate *)[[UIApplication sharedApp

我正在cocos2d中制作应用程序。我想在我的应用程序中使用增强现实,因此我已经在应用程序代理中添加了摄影机覆盖的代码,并在我的场景中使用它。但问题是,我想在运行时使用它。我在场景中添加背景的代码

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

在上面我隐藏了覆盖图。但是我想在点击事件中将我的CCSprite更改为透明图像并显示覆盖图。在这里我添加了我的层精灵

 @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以及显示相机视图的方法


谢谢,

你应该读一读

我已经实现了相同的功能,但希望在运行时用“替换我的背景”来显示相机覆盖,然后用onclick按钮再次翻转到背景。