十五、顺序执行动作重复动作



#include "Action_2.h"


Action_2::Action_2()
{
}


Action_2::~Action_2()
{
}

CCScene *Action_2::scene()
{
 CCSize size = CCDirector::sharedDirector()->getWinSize();
 Action_2 *layer = Action_2::create();
 CCScene *scene = CCScene::create();
 scene->addChild(layer);
 return scene;
}
bool Action_2::init()
{
 CCSize size = CCDirector::sharedDirector()->getWinSize();

 CCSprite *sp1 = CCSprite::create("20160222150945.png");
 sp1->setPosition(ccp(size.width*0.1, size.height*0.1));
 addChild(sp1);
 
 //移动
 //CCActionInterval *move = CCMoveTo::create(3.3f, ccp(size.width*0.9, size.height*0.9));
 //sp1->runAction(move);
 //sp1->runAction(CCMoveTo::create(3.3f, ccp(size.width*0.9, size.height*0.9)));

 //跳跃
 CCActionInterval *jump = CCJumpTo::create(10.0f, ccp(size.width*0.1, size.height*0.1), 120.0f, 4);
 //sp1->runAction(jump);

 //放大 缩小第一个参数小于0
 //sp1->runAction(CCScaleTo::create(1.0f,2.0f));

 //旋转
 //sp1->runAction(CCRotateTo::create(1.0f, 2.0f));
 
 //倾斜
 //sp1->runAction(CCSkewTo::create(2.0f, 20.0f,20.0));

 //闪烁
 //sp1->runAction(CCBlink::create(2.0, 19));

 //淡入
 //sp1->runAction(CCFadeIn::create(30.f));

 //淡出
 //sp1->runAction(CCFadeOut::create(30.f));

 //
 //sp1->runAction(CCFadeIn::create(3.f));

 //颜色渐变
 //sp1->runAction(CCTintTo::create(3.f,255,121,100));
 
 //线条曲线
 CCPointArray *arr = CCPointArray::create(10);
 arr->addControlPoint(ccp(size.width*0.2, size.height*0.2));
 arr->addControlPoint(ccp(size.width*0.2, size.height*0.8));
 arr->addControlPoint(ccp(size.width*0.8, size.height*0.8));
 arr->addControlPoint(ccp(size.width*0.8, size.height*0.2));
 arr->addControlPoint(ccp(size.width*0.2, size.height*0.2));

 CCActionInterval *spline = CCCardinalSplineTo::create(5.0f, arr, 3.0f);
 //sp1->runAction(spline);

 //顺序执行
 //CCActionInterval *seq = CCSequence::create(spline, jump, NULL);
 //sp1->runAction(seq);

 //同时执行
 //CCActionInterval *sae = CCSpawn::create(spline, jump, NULL);
 //sp1->runAction(sae);

 //CCdelaytime
 CCActionInterval *seq = CCSequence::create(spline, CCDelayTime::create(2.1f),jump, NULL);
 //sp1->runAction(seq);
 
 //重复五次
 sp1->runAction(CCRepeat::create(seq, 5));
 
 //永久重复
 //sp1->runAction(CCRepeatForever::create(seq));
 return true;
}

void callback()

{

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值