本文整理汇总了C++中CCActionInterval::reverse方法的典型用法代码示例。如果您正苦于以下问题:C++ CCActionInterval::reverse方法的具体用法?C++ CCActionInterval::reverse怎么用?C++ CCActionInterval::reverse使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCActionInterval
的用法示例。
在下文中一共展示了CCActionInterval::reverse方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addChild
//------------------------------------------------------------------
//
// LayerTest2
//
//------------------------------------------------------------------
void LayerTest2::onEnter()
{
LayerTest::onEnter();
CCSize s = CCDirector::sharedDirector()->getWinSize();
CCLayerColor* layer1 = CCLayerColor::create( ccc4(255, 255, 0, 80), 100, 300);
layer1->setPosition(ccp(s.width/3, s.height/2));
layer1->ignoreAnchorPointForPosition(false);
addChild(layer1, 1);
CCLayerColor* layer2 = CCLayerColor::create( ccc4(0, 0, 255, 255), 100, 300);
layer2->setPosition(ccp((s.width/3)*2, s.height/2));
layer2->ignoreAnchorPointForPosition(false);
addChild(layer2, 1);
CCActionInterval* actionTint = CCTintBy::create(2, -255, -127, 0);
CCActionInterval* actionTintBack = actionTint->reverse();
CCActionInterval* seq1 = CCSequence::create( actionTint, actionTintBack, NULL);
layer1->runAction(seq1);
CCActionInterval* actionFade = CCFadeOut::create(2.0f);
CCActionInterval* actionFadeBack = actionFade->reverse();
CCActionInterval* seq2 = CCSequence::create(actionFade, actionFadeBack, NULL);
layer2->runAction(seq2);
}
示例2: ccp
Parallax1::Parallax1()
{
// Top Layer, a simple image
CCSprite* cocosImage = CCSprite::spriteWithFile(s_Power);
// scale the image (optional)
cocosImage->setScale( 2.5f );
// change the transform anchor point to 0,0 (optional)
cocosImage->setAnchorPoint( ccp(0,0) );
// Middle layer: a Tile map atlas
CCTileMapAtlas *tilemap = CCTileMapAtlas::tileMapAtlasWithTileFile(s_TilesPng, s_LevelMapTga, 16, 16);
tilemap->releaseMap();
// change the transform anchor to 0,0 (optional)
tilemap->setAnchorPoint( ccp(0, 0) );
// Anti Aliased images
tilemap->getTexture()->setAntiAliasTexParameters();
// background layer: another image
CCSprite* background = CCSprite::spriteWithFile(s_back);
// scale the image (optional)
background->setScale( 1.5f );
// change the transform anchor point (optional)
background->setAnchorPoint( ccp(0,0) );
// create a void node, a parent node
CCParallaxNode* voidNode = CCParallaxNode::node();
// NOW add the 3 layers to the 'void' node
// background image is moved at a ratio of 0.4x, 0.5y
voidNode->addChild(background, -1, ccp(0.4f,0.5f), CCPointZero);
// tiles are moved at a ratio of 2.2x, 1.0y
voidNode->addChild(tilemap, 1, ccp(2.2f,1.0f), ccp(0,-200) );
// top image is moved at a ratio of 3.0x, 2.5y
voidNode->addChild(cocosImage, 2, ccp(3.0f,2.5f), ccp(200,800) );
// now create some actions that will move the 'void' node
// and the children of the 'void' node will move at different
// speed, thus, simulation the 3D environment
CCActionInterval* goUp = CCMoveBy::actionWithDuration(4, ccp(0,-500) );
CCActionInterval* goDown = goUp->reverse();
CCActionInterval* go = CCMoveBy::actionWithDuration(8, ccp(-1000,0) );
CCActionInterval* goBack = go->reverse();
CCFiniteTimeAction* seq = CCSequence::actions(goUp, go, goDown, goBack, NULL);
voidNode->runAction( (CCRepeatForever::actionWithAction((CCActionInterval*) seq) ));
addChild( voidNode );
}
示例3: onEnter
//------------------------------------------------------------------
//
// SpriteEaseBack
//
//------------------------------------------------------------------
KDvoid SpriteEaseBack::onEnter ( KDvoid )
{
TestEaseActions::onEnter ( );
CCSize s = this->getContentSize ( );
CCActionInterval* move = CCMoveBy::create(3, ccp(s.cx-130, 0 ) );
CCActionInterval* move_back = move->reverse();
CCActionInterval* move_ease_in = CCEaseBackIn::create ( CCCA ( move ) );
CCActionInterval* move_ease_in_back = move_ease_in->reverse();
CCActionInterval* move_ease_out = CCEaseBackOut::create ( CCCA ( move ) );
CCActionInterval* move_ease_out_back = move_ease_out->reverse();
CCDelayTime *delay = CCDelayTime::create(0.25f);
CCSequence* seq1 = CCSequence::create(move, delay, move_back, CCCA(delay), KD_NULL);
CCSequence* seq2 = CCSequence::create(move_ease_in, CCCA(delay), move_ease_in_back, CCCA(delay), KD_NULL);
CCSequence* seq3 = CCSequence::create(move_ease_out, CCCA(delay), move_ease_out_back, CCCA(delay), KD_NULL);
m_grossini->runAction(CCRepeatForever::create ( seq1 ) );
m_tamara->runAction(CCRepeatForever::create ( seq2 ) );
m_kathia->runAction(CCRepeatForever::create ( seq3 ) );
}
示例4: birdReadyAction
void GameScene::birdReadyAction()
{
CCSize winSize =CCDirector::sharedDirector()->getWinSize();
// 添加bird精灵
CCSprite *bird =CCSprite::createWithSpriteFrame(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName("bird1.png"));
bird->setPosition(ccp(winSize.width/2-80,winSize.height/2+20));
bird->setZOrder(20);
bird->setScale(0.6);
bird->setTag(TAG_BIRD);
bird->setVisible(false);
this->addChild(bird);
// 创建动画对象
CCAnimation *birdAnimation =CCAnimation::create();
birdAnimation->setDelayPerUnit(0.2);
birdAnimation->addSpriteFrame(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName("bird1.png"));
birdAnimation->addSpriteFrame(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName("bird2.png"));
birdAnimation->addSpriteFrame(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName("bird3.png"));
// 创建动画动作
birdanimate =CCAnimate::create(birdAnimation);
CCActionInterval *action =CCMoveBy::create(0.2,ccp(0,10));
CCActionInterval *action1 =action->reverse();
CCActionInterval *sequence =CCSequence::create(action,action1,NULL);
CCSpawn *spawn =CCSpawn::create(sequence,birdanimate,NULL);
CCRepeatForever *birdrepeatForever =CCRepeatForever::create(spawn);
// 让bird精灵一直运行动画
bird->runAction(birdrepeatForever);
}
示例5: defaultPlay
void ParticleComponentTest::defaultPlay()
{
CCComRender* Particle = static_cast<CCComRender*>(m_rootNode->getChildByTag(10020)->getComponent("CCParticleSystemQuad"));
CCActionInterval* jump = CCJumpBy::create(5, ccp(-500,0), 50, 4);
CCFiniteTimeAction* action = CCSequence::create( jump, jump->reverse(), NULL);
Particle->getNode()->runAction(action);
}
示例6: addChild
//------------------------------------------------------------------
//
// NodeToWorld
//
//------------------------------------------------------------------
NodeToWorld::NodeToWorld()
{
//
// This code tests that nodeToParent works OK:
// - It tests different anchor Points
// - It tests different children anchor points
CCSprite *back = CCSprite::create(s_back3);
addChild( back, -10);
back->setAnchorPoint( ccp(0,0) );
CCSize backSize = back->getContentSize();
CCMenuItem *item = CCMenuItemImage::create(s_PlayNormal, s_PlaySelect);
CCMenu *menu = CCMenu::create(item, NULL);
menu->alignItemsVertically();
menu->setPosition( ccp(backSize.width/2, backSize.height/2));
back->addChild(menu);
CCActionInterval* rot = CCRotateBy::create(5, 360);
CCAction* fe = CCRepeatForever::create( rot);
item->runAction( fe );
CCActionInterval* move = CCMoveBy::create(3, ccp(200,0));
CCActionInterval* move_back = move->reverse();
CCSequence* seq = CCSequence::create( move, move_back, NULL);
CCAction* fe2 = CCRepeatForever::create(seq);
back->runAction(fe2);
}
示例7: getChildByTag
//------------------------------------------------------------------
//
// Effect2
//
//------------------------------------------------------------------
void Effect2::onEnter()
{
EffectAdvanceTextLayer::onEnter();
CCNode* target = getChildByTag(kTagBackground);
// To reuse a grid the grid size and the grid type must be the same.
// in this case:
// ShakyTiles is TiledGrid3D and it's size is (15,10)
// Shuffletiles is TiledGrid3D and it's size is (15,10)
// TurnOfftiles is TiledGrid3D and it's size is (15,10)
CCActionInterval* shaky = CCShakyTiles3D::actionWithRange(4, false, ccg(15,10), 5);
CCActionInterval* shuffle = CCShuffleTiles::actionWithSeed(0, ccg(15,10), 3);
CCActionInterval* turnoff = CCTurnOffTiles::actionWithSeed(0, ccg(15,10), 3);
CCActionInterval* turnon = turnoff->reverse();
// reuse 2 times:
// 1 for shuffle
// 2 for turn off
// turnon tiles will use a new grid
CCFiniteTimeAction* reuse = CCReuseGrid::actionWithTimes(2);
CCActionInterval* delay = CCDelayTime::actionWithDuration(1);
// id orbit = [OrbitCamera::actionWithDuration:5 radius:1 deltaRadius:2 angleZ:0 deltaAngleZ:180 angleX:0 deltaAngleX:-90];
// id orbit_back = [orbit reverse];
//
// [target runAction: [RepeatForever::actionWithAction: [Sequence actions: orbit, orbit_back, nil]]];
target->runAction( (CCActionInterval *)(CCSequence::actions( shaky, delay, reuse, shuffle, delay->copy()->autorelease(), turnoff, turnon, NULL) ) );
}
示例8: reduceLife
void MapScene::reduceLife(int num)
{
(player->getsprite())->stopAllActions();
/*switch(playerlife){
case 3:
life1->setIsVisible(false);
playerlife --;
break;
case 2:
life2->setIsVisible(false);
playerlife --;
break;
case 1:
life3->setIsVisible(false);
playerlife --;
break;
}*/
if(player->life-num == 5)
{
}
CCActionInterval* action = CCRotateBy::actionWithDuration(0.05, 15);
(player->getsprite())->runAction(CCSequence::actions(action, action->reverse(), NULL));
//这里还需要加入对frozen状态的判断此时不无敌,即reduce=false;
//schedule(schedule_selector(MapScene::resetreduce), 0.2f);
//isreduce = true;
}
示例9: onEnter
void SpriteEaseBack::onEnter()
{
EaseSpriteDemo::onEnter();
CCSize s = CCDirector::sharedDirector()->getWinSize();
CCActionInterval* move = CCMoveBy::create(3, CCPointMake(s.width-130, 0));
CCActionInterval* move_back = move->reverse();
CCActionInterval* move_ease_in = CCEaseBackIn::create((CCActionInterval*)(move->copy()->autorelease()));
CCActionInterval* move_ease_in_back = move_ease_in->reverse();
CCActionInterval* move_ease_out = CCEaseBackOut::create((CCActionInterval*)(move->copy()->autorelease()));
CCActionInterval* move_ease_out_back = move_ease_out->reverse();
CCDelayTime *delay = CCDelayTime::create(0.25f);
CCFiniteTimeAction* seq1 = CCSequence::create(move, delay, move_back, CCCA(delay), NULL);
CCFiniteTimeAction* seq2 = CCSequence::create(move_ease_in, CCCA(delay), move_ease_in_back, CCCA(delay), NULL);
CCFiniteTimeAction* seq3 = CCSequence::create(move_ease_out, CCCA(delay), move_ease_out_back, CCCA(delay), NULL);
m_grossini->runAction(CCRepeatForever::create((CCActionInterval*)seq1));
m_tamara->runAction(CCRepeatForever::create((CCActionInterval*)seq2));
m_kathia->runAction(CCRepeatForever::create((CCActionInterval*)seq3));
}
示例10: onEnter
void CCTransitionSplitCols::onEnter()
{
CCTransitionScene::onEnter();
m_pInScene->setVisible(false);
CCActionInterval* split = action();
CCActionInterval* seq = (CCActionInterval*)CCSequence::create
(
split,
CCCallFunc::create(this, callfunc_selector(CCTransitionScene::hideOutShowIn)),
split->reverse(),
NULL
);
this->runAction
(
CCSequence::create
(
easeActionWithAction(seq),
CCCallFunc::create(this, callfunc_selector(CCTransitionScene::finish)),
CCStopGrid::create(),
NULL
)
);
}
示例11: onEnter
void SpriteEaseSine::onEnter()
{
EaseSpriteDemo::onEnter();
CCActionInterval* move = CCMoveBy::create(3, ccp(VisibleRect::right().x-130, 0));
CCActionInterval* move_back = move->reverse();
CCActionInterval* move_ease_in = CCEaseSineIn::create((CCActionInterval*)(move->copy()->autorelease()) );
CCActionInterval* move_ease_in_back = move_ease_in->reverse();
CCActionInterval* move_ease_out = CCEaseSineOut::create((CCActionInterval*)(move->copy()->autorelease()) );
CCActionInterval* move_ease_out_back = move_ease_out->reverse();
CCDelayTime *delay = CCDelayTime::create(0.25f);
CCSequence* seq1 = CCSequence::create(move, delay, move_back, CCCA(delay), NULL);
CCSequence* seq2 = CCSequence::create(move_ease_in, CCCA(delay), move_ease_in_back, CCCA(delay), NULL);
CCSequence* seq3 = CCSequence::create(move_ease_out, CCCA(delay), move_ease_out_back, CCCA(delay), NULL);
m_grossini->runAction( CCRepeatForever::create(seq1));
m_tamara->runAction( CCRepeatForever::create(seq2));
m_kathia->runAction( CCRepeatForever::create(seq3));
}
示例12: onEnter
//------------------------------------------------------------------
//
// ParallaxParticle
//
//------------------------------------------------------------------
void ParallaxParticle::onEnter()
{
ParticleDemo::onEnter();
m_background->getParent()->removeChild(m_background, true);
m_background = NULL;
CCParallaxNode* p = CCParallaxNode::node();
addChild(p, 5);
CCSprite *p1 = CCSprite::spriteWithFile(s_back3);
CCSprite *p2 = CCSprite::spriteWithFile(s_back3);
p->addChild( p1, 1, CGPointMake(0.5f,1), CGPointMake(0,250) );
p->addChild(p2, 2, CGPointMake(1.5f,1), CGPointMake(0,50) );
m_emitter = CCParticleFlower::node();
m_emitter->retain();
m_emitter->setTexture( CCTextureCache::sharedTextureCache()->addImage(s_fire) );
p1->addChild(m_emitter, 10);
m_emitter->setPosition( CGPointMake(250,200) );
CCParticleSun* par = CCParticleSun::node();
p2->addChild(par, 10);
par->setTexture( CCTextureCache::sharedTextureCache()->addImage(s_fire) );
CCActionInterval* move = CCMoveBy::actionWithDuration(4, CGPointMake(300,0));
CCActionInterval* move_back = move->reverse();
CCFiniteTimeAction* seq = CCSequence::actions( move, move_back, NULL);
p->runAction(CCRepeatForever::actionWithAction((CCActionInterval*)seq));
}
示例13: onEnter
void SpriteEase::onEnter()
{
EaseSpriteDemo::onEnter();
CCActionInterval* move = CCMoveBy::actionWithDuration(3, CCPointMake(350,0) );
CCActionInterval* move_back = move->reverse();
CCActionInterval* move_ease_in = (CCActionInterval*)CCEaseIn::actionWithAction((CCActionInterval*)(move->copy()->autorelease()), 3.0f);
CCActionInterval* move_ease_in_back = move_ease_in->reverse();
CCActionInterval* move_ease_out = CCEaseOut::actionWithAction((CCActionInterval*)(move->copy()->autorelease()), 3.0f);
CCActionInterval* move_ease_out_back = move_ease_out->reverse();
CCFiniteTimeAction* seq1 = CCSequence::actions(move, move_back, NULL);
CCFiniteTimeAction* seq2 = CCSequence::actions(move_ease_in, move_ease_in_back, NULL);
CCFiniteTimeAction* seq3 = CCSequence::actions(move_ease_out, move_ease_out_back, NULL);
CCAction *a2 = m_grossini->runAction( CCRepeatForever::actionWithAction((CCActionInterval*)seq1) );
a2->setTag(1);
CCAction *a1 = m_tamara->runAction( CCRepeatForever::actionWithAction((CCActionInterval*)seq2) );
a1->setTag(1);
CCAction *a = m_kathia->runAction( CCRepeatForever::actionWithAction((CCActionInterval*)seq3) );
a->setTag(1);
schedule(schedule_selector(SpriteEase::testStopAction), 6);
}
示例14: CCPointMake
//------------------------------------------------------------------
//
// NodeToWorld
//
//------------------------------------------------------------------
NodeToWorld::NodeToWorld()
{
//
// This code tests that nodeToParent works OK:
// - It tests different anchor Points
// - It tests different children anchor points
CCSprite *back = CCSprite::spriteWithFile(s_back3);
addChild( back, -10);
back->setAnchorPoint( CCPointMake(0,0) );
CCSize backSize = back->getContentSize();
CCMenuItem *item = CCMenuItemImage::itemFromNormalImage(s_PlayNormal, s_PlaySelect);
CCMenu *menu = CCMenu::menuWithItems(item, NULL);
menu->alignItemsVertically();
menu->setPosition( CCPointMake(backSize.width/2, backSize.height/2));
back->addChild(menu);
CCActionInterval* rot = CCRotateBy::actionWithDuration(5, 360);
CCAction* fe = CCRepeatForever::actionWithAction( rot);
item->runAction( fe );
CCActionInterval* move = CCMoveBy::actionWithDuration(3, CCPointMake(200,0));
CCActionInterval* move_back = move->reverse();
CCFiniteTimeAction* seq = CCSequence::actions( move, move_back, NULL);
CCAction* fe2 = CCRepeatForever::actionWithAction((CCActionInterval*)seq);
back->runAction(fe2);
}
示例15:
//------------------------------------------------------------------
//
// Test6
//
//------------------------------------------------------------------
Test6::Test6()
{
CCSprite* sp1 = CCSprite::spriteWithFile(s_pPathSister1);
CCSprite* sp11 = CCSprite::spriteWithFile(s_pPathSister1);
CCSprite* sp2 = CCSprite::spriteWithFile(s_pPathSister2);
CCSprite* sp21 = CCSprite::spriteWithFile(s_pPathSister2);
sp1->setPosition(CCPointMake(100,160));
sp2->setPosition(CCPointMake(380,160));
CCActionInterval* rot = CCRotateBy::actionWithDuration(2, 360);
CCActionInterval* rot_back = rot->reverse();
CCAction* forever1 = CCRepeatForever::actionWithAction(
(CCActionInterval*)(CCSequence::actions(rot, rot_back, NULL)));
CCAction* forever11 = (CCAction*)(forever1->copy()->autorelease());
CCAction* forever2 = (CCAction*)(forever1->copy()->autorelease());
CCAction* forever21 = (CCAction*)(forever1->copy()->autorelease());
addChild(sp1, 0, kTagSprite1);
sp1->addChild(sp11);
addChild(sp2, 0, kTagSprite2);
sp2->addChild(sp21);
sp1->runAction(forever1);
sp11->runAction(forever11);
sp2->runAction(forever2);
sp21->runAction(forever21);
schedule( schedule_selector(Test6::addAndRemove), 2.0f);
}