Questions tagged [ccmenuitem]

CCMenuItem is a class from the popular Cocos2d engine.

CCMenuItem is a class from the popular Cocos2d engine. It is used as an item of a CCMenu.

CCMenuItem itself has minimal functionality, its subclasses are used to create the different types of menus such as CCMenuItemImage and CCMenuItemFont.

CCMenuItem inherits from CCNode and as such can be transformed using CCActions or manually using the properties of CCNode.

Documentation cocos2d-iphone 1.1,

http://www.cocos2d-iphone.org/api-ref/1.1.0/interface_c_c_menu_item.html

Documentation cocos2d-iphone 2.0,

http://www.cocos2d-iphone.org/api-ref/2.0.0/interface_c_c_menu_item.html

59 questions
0
votes
2 answers

Have CCMenuItem fire its block on touchdown

CCMenuItem default fires its block on touchup. I'd like to change this to touchdown. Anyway to perform this without modifying CCMenu class (which would break other parts). Can this be done in a category? Wonder why the events are not implemented…
Jonny
  • 15,955
  • 18
  • 111
  • 232
0
votes
1 answer

ccmenuitem click response position is off after changing cccamera coordinates

I'm developing an ios game with cocos2d currently. There is a ccmenuitem on the screen. As the game starts, the player moves forward. In order to keep the player on the centre of the screen, the cccamera coordinates are changing according to…
0
votes
1 answer

disable touches behind a sprite

I have a menu in my app, with clickable buttons using CCMenuItemImage. When you press one of the buttons, for example buy button it spawns anther image on top of everything, a confirmation screen(do you really want to buy this item). This screen is…
Aaron
  • 41
  • 5
0
votes
3 answers

Cocos2D: how to tweak CCMenuItem with only one sprite?

how could I tweak CCMenuItemSprite to support only one sprite? Currently I have: [CCMenuItemSprite itemWithNormalSprite:one selectedSprite:selectedOne] But would like to have: [CCMenuItemSprite itemWithNormalSprite:one] EDIT: I want to modify…
mm24
  • 9,280
  • 12
  • 75
  • 170
0
votes
1 answer

When I tap AdView, CCMenuItem respond

I'm using kobold2d v2.1.0 and added AdMob Mediation SDK to my project according to Google's instructions. I created AdViewController and added its view to rootViewController.view. AdViewController.m: -(void)viewDidLoad { [super viewDidLoad]; …
noprops
  • 311
  • 3
  • 12
0
votes
2 answers

Second time entering scene, input not accepted

I've found a peculiarity with Cocos2D and I cannot seem to fix it. From the AppDelegate I load into a Menu, which is a CCScene. The scene holds a CCLayer, which itself holds the CCMenu. Everything works find the first time through. After my game has…
Clev3r
  • 1,568
  • 1
  • 15
  • 28
0
votes
1 answer

Cocos2d-x run activate() in the selected() method and disable it in ccTouchEnded?

I'm making a subclass of CCMenuItemImage that executes it's method when the touch begins instead of when it ends. I tried running activate() in the selected() method, which works, but it is executed again as expected when the touch ends. How can I…
David Small
  • 581
  • 1
  • 10
  • 25
0
votes
1 answer

Dynamic CCMenu with Cocos2d

I wanted to create a menu in cocos2d in which the menu items would drift through the screen, disappear, and then re-appear. I haven't been able to find anything that showed the CCMenuItem's animating, or moving. Is this possible to do? Or would I be…
bluestunt
  • 479
  • 4
  • 11
0
votes
2 answers

Cocos2d-x Subclassing Issue CCMenuItemImage

I'm trying to create a button that is derived from the base class CCMenuItemImage. I want this button to be able to call it's function when it's first touched instead of after the touch ends. However, trying to subclass, I get an error saying it's…
David Small
  • 581
  • 1
  • 10
  • 25
0
votes
2 answers

Cocos2d. CCMenuItem with custom touchable region?

For example, in my case every button look likes a hex. Hex pictures on these buttons can't intersect but their rects can.
Gargo
  • 1,135
  • 1
  • 10
  • 21
0
votes
1 answer

same CCMenu Adding to Multiple Scenes

Newbie to iOS and Cocos2d ( 2.x ) Ok I want to create a Menu Object and call it from each new Scene. Example: Scene1, add menu Scene2, add same menu as on Scene1 I've only seen how to initialize the CCMenu when you init the Layer itself. you build…
Phill Pafford
  • 83,471
  • 91
  • 263
  • 383
0
votes
1 answer

cocos2d: Subclassing CCMenuItem triggers a lot of "removeChildByTag: child not found!"

I am trying to subclass a CCMenuItem using the following code: GenericButton.h #import #import "cocos2d.h" @interface GenericButton : CCMenuItemSprite { } +(id) itemwithTitle:(NSString*)title withBGColor: (ccColor3B)…
Cyril Gaillard
  • 909
  • 9
  • 28
0
votes
1 answer

Touch accuracy of ccmenuitem is lower when it is placed adjacent to screen edge

When I tried to build and run my game(based on Cocos2d 1.0.1, built in Xcode 4.5 with iOS 6.0 SDK) on iTouch 5, I found the CCMenuItems do not behave normally: when the menuitem is adjacent to screen edge, the edge border seems not so easy to be…
OriginalWood
  • 391
  • 1
  • 4
  • 9
0
votes
2 answers

How do I manually call a SEL_MenuHandler

I understand that a CCMenuItem has a CCObject* rec and a SEL_MenuHandler selector and that it will call them when selected but I'd like to know if, given just those two variables, I can manually call them myself and, if so, how? I'm aware of…
Josh Paradroid
  • 1,172
  • 18
  • 45
0
votes
1 answer

Changing the selector of a CCMenuItem

Is it possible to reassign the selector of a CCMenuItem once it's been created? I'm looking to do something like this: //Initialization: _menuItem =[CCMenuItemSprite itemWithNormalSprite:normalSprite selectedSprite:selectedSprite target:self…
James
  • 736
  • 1
  • 5
  • 19