瞬时动作的函数

void MyAction::goMenu(Ref* pSender)
{   
    log("Tag = %i",this->getTag());
	Size size = Director::getInstance()->getVisibleSize();
	Vec2 p = Vec2(CCRANDOM_0_1() * size.width, CCRANDOM_0_1() * size.height);
	
	switch (this->getTag()) {
		case PLACE_TAG:
            sprite->runAction(Place::create(p));
			break;
		case FLIPX_TAG:
			sprite->runAction(FlipX::create(true));
			break;
		case FLIPY_TAG:
            sprite->runAction(FlipY::create(true));
			break;
		case HIDE_SHOW_TAG:
			if (hiddenFlag) {
                sprite->runAction(Hide::create());
				hiddenFlag = false;
			} else {
                sprite->runAction(Show::create());
				hiddenFlag = true;
			}
			break;
		case TOGGLE_TAG:
            sprite->runAction(ToggleVisibility::create());
			break;
		default:
			break;
	}


posted @ 2015-09-26 21:01  Anzhongliu  阅读(289)  评论(0编辑  收藏  举报