[英]Animating a CCMenuItem in Cocos2d iphone
I created this code below to show a button in the view in init statement: 我在下面创建了这段代码,在init语句的视图中显示了一个按钮:
CCMenuItem *contacts = [CCMenuItemImage
itemFromNormalImage:@"play.png" selectedImage:@"play.png"
target:self selector:@selector(switchcontact)];
contacts.position = ccp(300, 550);
CCMenu *starMenu6 = [CCMenu menuWithItems:contacts, nil];
starMenu6.position = CGPointZero;
[self addChild:starMenu6];
I need to rotate or animate this button in the view in same position, just like the Fruitninjas menu button. 我需要在视图中旋转或设置此按钮的相同位置,就像Fruitninjas菜单按钮一样。 How could I do this?
我怎么能这样做?
Thanks in advance. 提前致谢。
Not familiar with the fruit ninja method but to rotate the contacts menu button do: 不熟悉水果忍者方法,但要旋转联系人菜单按钮,请执行以下操作:
[contacts runAction:[CCRepeatForever actionWithAction:[CCRotateBy actionWithDuration:.5 angle:45]]];
You could do it on the menu as well, they're both CCNodes. 您也可以在菜单上执行此操作,它们都是CCNode。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.