使用 CCMenu 我创建了两个向上和向下按钮 这是代码
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];
如何编写 upItemTouched 和 downItemTouched 方法
此外,精灵应该在屏幕上平滑移动
我是 cocos2d 的新手,所以请接受我的简单问题......