I can't test this on my phone because I'm poor and a new iOS programmer so I don't know if this is just an issue with the simulator or what. Also very new to cocos2d so bear with me here. I am working on a starting screen for my game. I made a background image with a cloud in the top left and in the top right. Then put a CCMenuItemLabel on each cloud so that it looks all prettiful. It works tremendously.... until you try to click either of the buttons in which case nothing happens! Here's the code I have right now.
MainMenu : CCScene
@implementation MainMenu
-(id) init {
// Play Label to left cloud
CCLabelTTF * playLabel = [CCLabelTTF labelWithString:@"Play" fontName:@"Marker Felt" fontSize:24];
playLabel.color = ccBLACK;
CCMenuItemLabel * play = [CCMenuItemLabel itemWithLabel:playLabel target:self selector:@selector(playGame)];
CCMenu * playmenu = [CCMenu menuWithItems:play, nil];
playmenu.position = ccp(s.width/5,s.height - 55);
[self addChild:playmenu z:10];
// Options label to right cloud
CCLabelTTF * optionsLabel = [CCLabelTTF labelWithString:@"Options" fontName:@"Marker Felt" fontSize:24];
optionsLabel.color = ccBLACK;
CCMenuItemLabel * options = [CCMenuItemLabel itemWithLabel:optionsLabel target:self selector:@selector(options)];
CCMenu * optmenu = [CCMenu menuWithItems:options, nil];
optmenu.position = ccp(s.width - s.width/5,s.height - 55);
[self addChild:optmenu z:10];
// Add background at z:-1 plus other
}
@end
s is my screen size and the rest seems to be pretty straight forward. This is all inside of a MainMenu.m which extends CCScene. As of right now my selectors are just NSLogs to make sure the clicking works. Which never runs for either of them.
What I've tried:
Based on a suggestion from the cocos2d forums I changed both selectors to @selector(playGame:)
and then the methods to -(void)playGame:(id) sender
but that didn't work either.
In the end I started a new project using the same template. I put the exact same code in from above and ran it. It works in this project. So I started copying and pasting things from the old project into this one to try to see what made it break and in the end nothing broke it. I guess it must have been something in the build phases or something but it all works now.