我想创建一个工具栏(最初是隐藏的),其中包含可以拖动的项目。如果点击一个按钮,工具栏将出现自下而上(就像键盘的动画一样)。就是想问一下在cocos2d中怎么做。
感谢您的回复!
我想创建一个工具栏(最初是隐藏的),其中包含可以拖动的项目。如果点击一个按钮,工具栏将出现自下而上(就像键盘的动画一样)。就是想问一下在cocos2d中怎么做。
感谢您的回复!
我使用此代码打开和关闭抽屉。
-(void)showMyCocos2DDrawer
{
CGSize s = [[CCDirector sharedDirector] winSize];
self.position = ccp(-s.width,0.0f); //do this in ur init method :)
CGPoint pos =ccp(0.0f, 0.0f );
id moveTo = [CCMoveTo actionWithDuration:0.5f position:pos];
id calFun = [CCCallFunc actionWithTarget:self selector:@selector(animDone)];
id seq = [CCSequence actions:moveTo, calFun, nil];
[self runAction:seq];
}
-(void)hideCocos2DDrawer
{
CGSize s = [[CCDirector sharedDirector] winSize];
CGPoint pos =ccp(-s.width, 0.0f);
id moveTo = [CCMoveTo actionWithDuration:0.3f position:pos];
id calFun = [CCCallFunc actionWithTarget:self selector:@selector(goBack)];
id seq = [CCSequence actions:moveTo, calFun, nil];
[self runAction:seq];
}
-(void) animDone
{
//write in code here..
}
-(void)goBack
{
//write out code here..
}