CCSprite覆盖场景cocos2d-iPhone

时间:2013-05-29 06:44:35

标签: iphone objective-c cocos2d-iphone

enter image description here我的应用程序正在生成我的游戏的方式。当我扩展我的sceenshoot(CCSprite)时,其他控件如CCMenu不起作用。我猜CCSprite(screeenshoot)覆盖我的场景。

如何在CCSprite缩小时控制我的CCMenu。 ?!

here is my code 

- (void) showGameOver
 {
    CCDirector *director = [CCDirector sharedDirector];
    appDelegate.screenshootimage = [director screenshotUIImage];

    imgsprite = [CCSprite spriteWithCGImage:appDelegate.screenshootimage.CGImage key:@"spriteKey"];

    if(flagRescale == false)
    {
           imgsprite.scaleX = 0.40;
           imgsprite.scaleY = 0.40;
           flagRescale = true;
    }

    CCMenuItemImage *image = [CCMenuItemSprite itemFromNormalSprite:imgsprite selectedSprite:nil target:self selector:@selector(imgAction)];

    image.position = ccp(40, 50);
    imageMenu = [CCMenu menuWithItems:image, nil];
    [self addChild:imageMenu];

    menu_.visible = true;
    menu_.position = ccp(windowCenter_.x, windowCenter_.y - 70);
    lblGameOver.visible = true;
    lblGameOver.position = ccp(windowCenter_.x, windowCenter_.y + 50);
    [[SimpleAudioEngine sharedEngine] stopBackgroundMusic];
}
-(void)imgAction
{
    if(flagRescale == TRUE)
    {
        imgsprite.scaleX = 0.7;
        imgsprite.scaleY = 0.7;
        flagRescale=false;
    }
    else
    {
        imgsprite.scaleX = 0.4;
        imgsprite.scaleY = 0.4;
        flagRescale=true;

    }
}

0 个答案:

没有答案