views:

268

answers:

1

I've decided to stick with cocos2d for game dev... For the menus it there a way to make it more customizable, like maybe instead of text maybe an image then is there a way to arrange them differently versus just in the center of the screen

A: 

Hi techy,

Check the tutorial that I have done for cocos2d menus.

It is quite simple to present images instead of text, and this you should select when creating a menu item. Have a look at MenuItemImage class.

As you can see in the suggested tutorial the piece of code create a menu

// Creating menu items
        MenuItem *start = [MenuItemFont itemFromString:@"Start" target:self selector:@selector(start:)];
        MenuItem *settings = [MenuItemFont itemFromString:@"Settings" target:self selector:@selector(settings:)];
        MenuItem *credits = [MenuItemFont itemFromString:@"Credits" target:self selector:@selector(credits:)];      
        MenuItem *help = [MenuItemFont itemFromString:@"Help" target:self selector:@selector(help:)];

        // Creating menu and adding items
        Menu *menu = [Menu menuWithItems:start, settings, credits, help, nil];
        // Set menu alignment to vertical
        [menu alignItemsVertically];

In your case, instead of use:

MenuItem *start = [MenuItemFont itemFromString:@"Start" target:self selector:@selector(start:)];
you con do

MenuItem *start = [MenuItemImage itemFromNormalImage:@"NameOfYourNormalImage.png" selectedImage:@"NameOfYourSelectedImage.png" target:self selector:@selector(start:)];

To position your menu, you should define a CGPoint and set the menu position to this point.

[menu setPosition:ccp(PositionOnX, PositionOnY)];

I hope this is what you are looking for.

Cheers,
VFN

vfn
Thank you! I just ended up doing the menuitemimage
techy