iPhone – create a menu in CoCos2D?

I need to know how to make a simple menu with 5 buttons and place them on the right side of the cocos2d screen. Do I create the menu in – (id)init? Any help is appreciated. Thanks!
You can use the following code to create a menu

 CCMenuItemImage *menuItem1 = [CCMenuItemImage itemFromNormalImage:@"menu.png" selectedImage:@"menu1.png" 
target:self selector:@selector(onClick:)];

CCMenu *menu = [CCMenu menuWithItems:menuItem1,nil];
menu.position = ccp(320,480);

[self addChild:menu z:100];

I hope this Can help…..

I need to know how to make a simple menu with 5 buttons and place them on the right side of the cocos2d screen. I’m at-(id ) Is the menu created in init? Any help is appreciated. Thanks!

You can use the following code to create a menu

CCMenuItemImage *menuItem1 = [CCMenuItemImage itemFromNormalImage:@"menu. png" selectedImage:@"menu1.png" 
target:self selector:@selector(onClick:)];

CCMenu *menu = [CCMenu menuWithItems:menuItem1,nil];
menu.position = ccp(320,480);

[self addChild:menu z:100];

Hope this can help…..

Leave a Comment

Your email address will not be published.