本文整理汇总了C++中Sequence::clone方法的典型用法代码示例。如果您正苦于以下问题:C++ Sequence::clone方法的具体用法?C++ Sequence::clone怎么用?C++ Sequence::clone使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sequence
的用法示例。
在下文中一共展示了Sequence::clone方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: init
bool LandSprite::init()
{
if (!Sprite::init())
{
return false;
}
Size visiableSize = Director::getInstance()->getVisibleSize();
Vec2 visiableOrigin = Director::getInstance()->getVisibleOrigin();
Sprite * landSprite1 = Sprite::create("assets/land.png");
landSprite1->setAnchorPoint(Vec2(0, 0));
landSprite1->setPosition(Vec2(visiableOrigin.x, visiableOrigin.y));
landSprite1->setScaleX(visiableSize.width / landSprite1->getContentSize().width / 2);
Sprite * landSprite2 = Sprite::create("assets/land.png");
landSprite2->setAnchorPoint(Vec2(0, 0));
landSprite2->setPosition(Vec2(visiableOrigin.x + visiableSize.width / 2, visiableOrigin.y));
landSprite2->setScaleX(visiableSize.width / landSprite2->getContentSize().width / 2);
Sprite * landSprite3 = Sprite::create("assets/land.png");
landSprite3->setAnchorPoint(Vec2(0, 0));
landSprite3->setPosition(Vec2(visiableOrigin.x + visiableSize.width, visiableOrigin.y));
landSprite3->setScaleX(visiableSize.width / landSprite3->getContentSize().width / 2);
Sprite * landSprite4 = Sprite::create("assets/land.png");
landSprite4->setAnchorPoint(Vec2(0, 0));
landSprite4->setPosition(Vec2(visiableOrigin.x + visiableSize.width * 1.5, visiableOrigin.y));
landSprite4->setScaleX(visiableSize.width / landSprite4->getContentSize().width / 2);
Node * landAnimNode = Node::create(); // node hold the land animation
landAnimNode->addChild(landSprite1);
landAnimNode->addChild(landSprite2);
landAnimNode->addChild(landSprite3);
landAnimNode->addChild(landSprite4);
MoveBy * landForward = MoveBy::create(5, Vec2(-visiableSize.width, 0));
MoveBy * landBackward = MoveBy::create(0.001, Vec2(visiableSize.width, 0));
Sequence * moveSeq = Sequence::create(landForward, 0.001, landBackward,NULL);
landSprite1->runAction(RepeatForever::create(moveSeq));
landSprite2->runAction(RepeatForever::create(moveSeq->clone()));
landSprite3->runAction(RepeatForever::create(moveSeq->clone()));
landSprite4->runAction(RepeatForever::create(moveSeq->clone()));
this->addChild(landAnimNode);
this->setAnchorPoint(Vec2(0, 0));
this->setContentSize(Size(visiableSize.width, landSprite1->getContentSize().height));
PhysicsBody * landPhysicsBody = PhysicsBody::createBox(Size(visiableSize.width, landSprite1->getContentSize().height), PhysicsMaterial(1, 1, 0));
landPhysicsBody->setGravityEnable(false);
landPhysicsBody->setDynamic(false);
landPhysicsBody->setContactTestBitmask(1);
landPhysicsBody->setCollisionBitmask(2);
this->setPhysicsBody(landPhysicsBody);
return true;
}
示例2: showWarWindow
void WarLayer::showWarWindow(Layer * layer, String title, String content) {
Size visibleSize = Director::getInstance()->getWinSize();
WarLayer * wl = WarLayer::getInstanceFrom(layer);
wl->setLabelWarTitle(title);
wl->setLabelWarContent(content);
wl->setBackground("layers/WarLayer.png");
wl->setPosition(visibleSize.width / 2 + 64 * 2, visibleSize.height / 2);
FadeOut * fadeOutFirst = FadeOut::create(0.0f);
FadeIn * fadeIn = FadeIn::create(0.5f);
FadeOut * fadeOut = FadeOut::create(0.5f);
//Sequence * sequence = Sequence::create(fadeOutFirst, fadeIn, fadeOut, NULL);
ScaleTo * scaleToFirst = ScaleTo::create(0.0f,0.0f);
ScaleTo * scaleToBig = ScaleTo::create(0.5f,1.0f);
ScaleTo * hold = ScaleTo::create(0.5f, 1.0f);
ScaleTo * scaleToSmall = ScaleTo::create(0.5f, 0.0f);
Spawn * spawnFirst = Spawn::create(fadeOutFirst,scaleToFirst,NULL);
Spawn * spawnIn = Spawn::create(fadeIn, scaleToBig, NULL);
Spawn * spawnOut = Spawn::create(fadeOut, scaleToSmall, NULL);
//Sequence * sequence = Sequence::create(scaleToFirst, hold, scaleToBig, scaleToSmall, NULL);
Sequence * sequence = Sequence::create(spawnFirst, spawnIn, hold, spawnOut, NULL);
wl->runAction(sequence->clone());
}