1
我决定坚持使用cocos2d作为游戏开发...对于菜单,有一种方法可以使其更具可定制性,就像也许而不是文本也许是一个图像,然后有一种方法来安排他们不同的方式而不仅仅是在屏幕的中心自定义Cocos2D菜单
我决定坚持使用cocos2d作为游戏开发...对于菜单,有一种方法可以使其更具可定制性,就像也许而不是文本也许是一个图像,然后有一种方法来安排他们不同的方式而不仅仅是在屏幕的中心自定义Cocos2D菜单
Check the tutorial that I have done for cocos2d menus。
显示图像而不是文本很简单,创建菜单项时应该选择此选项。看看MenuItemImage类。
正如你可以在建议参见教程的一段代码创建一个菜单
// 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];
在你的情况,而不是使用:
MenuItem *start = [MenuItemFont itemFromString:@"Start" target:self selector:@selector(start:)];
你CON做
MenuItem *start = [MenuItemImage itemFromNormalImage:@"NameOfYourNormalImage.png" selectedImage:@"NameOfYourSelectedImage.png" target:self selector:@selector(start:)];
要定位你的菜单,你应该定义一个CGPoint并将菜单位置设置到这一点。
[menu setPosition:ccp(PositionOnX, PositionOnY)];
我希望这是你在找什么。
干杯,
VFN
谢谢!我刚刚做了菜单式的照片 – techy