间隔动作函数

void MyAction::goMenu(Ref* pSender)
{   
	log("Tag = %i",this->getTag());
	Size size = Director::getInstance()->getVisibleSize();

	ccBezierConfig bezier;

	switch (this->getTag()) {
	case kMoveTo:
		sprite->runAction(MoveTo::create(2,Vec2(size.width - 50, size.height - 50)));
		break;
	case kMoveBy:
		sprite->runAction(MoveBy::create(2,Vec2(-50, -50)));
		break;
	case kJumpTo:
		sprite->runAction(JumpTo::create(2,Vec2(150, 50),30,5));
		break;
	case kJumpBy:
		sprite->runAction(JumpBy::create(2,Vec2(100, 100),30,5));
		break;
	case kBezierBy:
		bezier.controlPoint_1 = Vec2(0, size.height/2);
		bezier.controlPoint_2 = Vec2(300, -size.height/2);
		bezier.endPosition = Vec2(100,100);
		sprite->runAction(BezierBy::create(3,bezier));
		break;
	case kScaleTo:
		sprite->runAction(ScaleTo::create(2, 4));
		break;
	case kScaleBy:
		sprite->runAction(ScaleBy::create(2, 0.5));
		break;
	case kRotateTo:
		sprite->runAction(RotateTo::create(2,180));
		break;
	case kRotateBy:
		sprite->runAction(RotateBy::create(2,-180));
		break;
	case kBlink:
		sprite->runAction(Blink::create(3, 5));
		break;
	case kTintTo:
		sprite->runAction(TintTo::create(2, 255, 0, 0));
		break;
	case kTintBy:
		sprite->runAction(TintBy::create(0.5,0, 255, 255));
		break;
	case kFadeTo:
		sprite->runAction(FadeTo::create(1, 80));
		break;
	case kFadeIn:
		sprite->setOpacity(10);
		sprite->runAction(FadeIn::create(1));
		break;
	case kFadeOut:
		sprite->runAction(FadeOut::create(1));
		break;
	default:
		break;
	}
}

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