CCMenuItemSprite strange behavior Kobold2d new iPad

216 views Asked by At

I'm developing a game and I'm having some troubles in my second scene.
I have a CCLayer class "NewGameLayer" that contains a CCLayer as a child "bookLayer", the "NewGameLayer" contains a CCSprite as child that is a custom keyboard that animates like the real keyboard.

Now the keyboard contains CCMenuItemSprites for the keys, the problem is that when I press a key it does nothing, the selector is not fired, the strange part of this is when I press and hold the button for like 3 secs the selector gets fired. Why is this happening? Could someone point me the right direction of doing this??

I'm adding the keyboard sprite to the main layer like this:

keyboard = [CCSprite spriteWithFile:@"fondoTeclado.png"];   
    keyboard.position = ccp(512, 1536);  
    [self addChild:keyboard];

and the CCMenu is created like this:

s0 = [CCMenuItemImage itemFromNormalImage:@"0.png" selectedImage:@"0.png" target:self    selector:@selector(keyPressed:)];                   
s0.position = ccp(748, 390);

menu = [CCMenu menuWithItems:s0, nil];   
    menu.position = ccp(60, 900);   
    [self addChild:menu];

Thanks in advance !

0

There are 0 answers