# How can I disable/dim the screen when I click the pause button?

I am working in an android game using cocos2d. I want to dim the background screen when I click the pause button.

How can I do this ?

• Do you mean dim the screen? The definitions I found of deem don't seem to fit your question unless I'm completely wrong. – Milkboat Nov 22 '11 at 12:18
• Maybe start drawing a rectangular over the surface that get's darker over time... – jcora Nov 25 '11 at 9:28

I achieved this effect by using a specified pixel from a texture I was already using in this way:

  CCSprite *layer = [CCSprite spriteWithTexture:TEX_INTERFACE.textureAtlas.texture rect:CGRectMake(87, 143, 1, 1)];
CGSize size = [[CCDirector sharedDirector] winSize];
layer.scaleX = size.width;
layer.scaleY = size.height;
layer.position = ccp(size.width/2, size.height/2);
layer.opacity = 0;

• you have to remove the sprite you added with [parent removeChildByTag:TAG_PAUSE_OVERLAY] – Jack Nov 28 '11 at 17:35