Tell me more ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Using CCMenu I have create Two Buttons Up and Down Here is the code

CCSprite *normlUp = [CCSprite spriteWithFile:@"Up.png"];
CCSprite *selectedUp = [CCSprite spriteWithFile:@"Up.png"];
selectedUp.color = ccGREEN;

CCMenuItemSprite *up = [CCMenuItemSprite itemFromNormalSprite:normlUp selectedSprite:selectedUp target:self selector:@selector(upItemTouched)];
up.position = CGPointMake(-220, -115);

CCSprite *normlDown = [CCSprite spriteWithFile:@"Down.jpeg"];
CCSprite *selectedDown = [CCSprite spriteWithFile:@"Down.jpeg"];
selectedDown.color = ccGREEN;

CCMenuItemSprite *down = [CCMenuItemSprite itemFromNormalSprite:normlDown selectedSprite:selectedDown target:self selector:@selector(downItemTouched)];
down.position = CGPointMake(-220,-140 );

CCMenu *upDown = [CCMenu menuWithItems:up,down,nil];
[self addChild:upDown z:4];

How to write upItemTouched and downItemTouched Methods
Also the sprite should move smoothly on the screen along y-axis
I am New to cocos2d so please accept my simple questions........

share|improve this question
is this for iPhone? If so, you should use sneaky joystick... It is easy to setup and there are a few tutorials to help with that bobueland.com/cocos2d/2011/sneaky-joystick – Savlon Mar 6 at 7:30
1  
As the @Savlon explains, CCMenuItem is not intended to create controls for a game object as you seem to be trying to do. – Karlos Zafra Mar 6 at 17:00

closed as too localized by bummzack, Sean Middleditch, Byte56, Trevor Powell, Josh Petrie Mar 29 at 14:39

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, see the FAQ.

Browse other questions tagged or ask your own question.