You cal also animate CCMenu like other sprites to have some effect on your Menu.
You can also place spritesheets in each MenuItem.
-(void) setUpMenu { CCSprite *Home1 = [CCSprite spriteWithFile:@"Home1.png"]; CCSprite *Home2 = [CCSprite spriteWithFile:@"Home1.png"]; Home2.opacity = 100; CCSprite *Levels1 = [CCSprite spriteWithFile:@"levels2.png"]; CCSprite *Levels2 = [CCSprite spriteWithFile:@"levels2.png"]; Levels2.opacity = 100; CCSprite *Refresh1 = [CCSprite spriteWithFile:@"refresh.png"]; CCSprite *Refresh2 = [CCSprite spriteWithFile:@"refresh.png"]; Refresh2.opacity = 100; CCSprite *go_back1 = [CCSprite spriteWithFile:@"back2.png"]; CCSprite *go_back2 = [CCSprite spriteWithFile:@"back2.png"]; go_back2.opacity = 100; CCMenuItemSprite *top_menuSprite1 = [CCMenuItemSprite itemFromNormalSprite:Home1 selectedSprite:Home2 target:self selector:@selector(goHome)]; CCMenuItemSprite *top_menuSprite2 = [CCMenuItemSprite itemFromNormalSprite:Levels1 selectedSprite:Levels2 target:self selector:@selector(goToLevelSelection)]; CCMenuItemSprite *top_menuSprite3 = [CCMenuItemSprite itemFromNormalSprite:Refresh1 selectedSprite:Refresh2 target:self selector:@selector(reloadGame)]; CCMenuItemSprite *top_menuSprite4 = [CCMenuItemSprite itemFromNormalSprite:go_back1 selectedSprite:go_back2 target:self selector:@selector(menuGoBack)]; top_menu = [CCMenu menuWithItems:top_menuSprite1,top_menuSprite2, top_menuSprite3 ,top_menuSprite4, nil]; [top_menu alignItemsVerticallyWithPadding:10.0f]; top_menu.position = ccp(240,160); [self addChild:top_menu z:2]; } -(void) loadMenu { CGPoint point1 = CGPointMake(570, 160); CGPoint point2 = CGPointMake(400,160); id FwdactionMove = [CCMoveTo actionWithDuration:.1 position:point1]; id ReverseactionMove = [CCMoveTo actionWithDuration:.1 position:point2]; id actionMoveDone = [CCCallFuncN actionWithTarget:self selector:@selector(done1:)]; [top_menu runAction:[CCSequence actions:FwdactionMove, ReverseactionMove,actionMoveDone, nil]]; } -(void) menuGoBack { [[CCDirector sharedDirector] resume]; CGPoint point1 = CGPointMake(300, 160); CGPoint point2 = CGPointMake(570,160); id FwdactionMove = [CCMoveTo actionWithDuration:.1 position:point1]; id ReverseactionMove = [CCMoveTo actionWithDuration:.1 position:point2]; id actionMoveDone = [CCCallFuncN actionWithTarget:self selector:@selector(goingBackMenu)]; [top_menu runAction:[CCSequence actions:FwdactionMove, ReverseactionMove,actionMoveDone, nil]]; [self backgroundGoBack]; } -(void) done1:(id) sender { [[CCDirector sharedDirector ] pause]; }
The above example moves the menu item from right to left and clicking on refresh it will go back.
The button that calls the loadMenu function will pause the screen and on refresh it will resume.