本文整理汇总了C++中CCAnimate::setTag方法的典型用法代码示例。如果您正苦于以下问题:C++ CCAnimate::setTag方法的具体用法?C++ CCAnimate::setTag怎么用?C++ CCAnimate::setTag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCAnimate
的用法示例。
在下文中一共展示了CCAnimate::setTag方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: init
bool Fish::init(FishType type)
{
_type = type;
CCString* animationName = CCString::createWithFormat(STATIC_DATA_STRING("fish_animation"), _type);
CCAnimation* fishAnimation = CCAnimationCache::sharedAnimationCache()->animationByName(animationName->getCString());
CCAnimate* fishAnimate = CCAnimate::create(fishAnimation);
fishAnimate->setTag(k_Action_Animate);
_fishSprite = CCSprite::create();
this->addChild(_fishSprite);
_fishSprite->runAction(CCRepeatForever::create(fishAnimate));
return true;
}
示例2: init
//-----------------------------------------------------------------------------
bool CFish::init(EFishType type)
{
//CCAnimation只是用于存放动画,真正让动画播放起来的是动作类CCAnimate
//CCAnimate只能由CCSprite及其子类播放
m_type = type;
CCString* animationName = CCString::createWithFormat(STATIC_DATA_STRING("fish_animation"), m_type);
CCAnimation* fishAnimation = CCAnimationCache::sharedAnimationCache()->animationByName(animationName->getCString());
CCAnimate* fishAnimate = CCAnimate::create(fishAnimation);
fishAnimate->setTag(k_Action_Animate);
m_fishSprite = CCSprite::create();
this->addChild(m_fishSprite);
m_fishSprite->runAction(CCRepeatForever::create(fishAnimate));
return true;
}
示例3: setAnimation
void AvatarComponent::setAnimation(CCAnimation * animation)
{
this->stopActionByTag(s_animationTag);
CC_SAFE_RELEASE_NULL(m_animation);
if (animation != nullptr)
{
m_animation = animation;
m_animation->retain();
this->setSpriteFrame(animation->getFrames().at(0)->getSpriteFrame());
CCAnimate * animate = CCAnimate::create(animation);
animate->setTag(s_animationTag);
this->runAction(animate);
}
}
示例4: resetActions
void AvatarComponent::resetActions()
{
m_animatorData->getInitData()->initializeNode(this);
m_animatorData->getAnimData()->runActions(this, m_animatorDataTags);
// 针对 offset time 的处理
CCDelayTime * delayTime = m_animatorData->getAnimData()->getDelayTimeAction();
if (delayTime != nullptr)
{
this->setVisible(false);
// 首先延迟 offset time 时间,然后显示动画(一定从第一帧开始)。
Vector<FiniteTimeAction *> actions;
actions.pushBack(delayTime);
actions.pushBack(Show::create());
actions.pushBack(CallFunc::create([this]{
this->stopActionByTag(s_animationTag);
this->setSpriteFrame(m_animation->getFrames().at(0)->getSpriteFrame());
CCAnimate * animate = CCAnimate::create(m_animation);
animate->setTag(s_animationTag);
this->runAction(animate);
}));
// 动画播放结束后,继续延迟,直到时间结束后,设置不可见。
actions.pushBack(DelayTime::create(m_animatorData->getAnimData()->getSumTime() - m_animatorData->getAnimData()->getOffsetTime()));
actions.pushBack(Hide::create());
Sequence * seq = Sequence::create(actions);
Action * action = nullptr;
if (m_animatorData->getAnimData()->isForever())
action = RepeatForever::create(seq);
else
action = seq;
action->setTag(206);
this->runAction(action);
}
}
示例5: introAction
void Player::introAction()
{
currentAnimation->setDelayPerUnit(0.09f);
currentAnimation->setRestoreOriginalFrame(true);
currentAnimation->addSpriteFrameWithFileName("yes1.png");
currentAnimation->addSpriteFrameWithFileName("yes2.png");
currentAnimation->addSpriteFrameWithFileName("yes3.png");
currentAnimation->addSpriteFrameWithFileName("yes4.png");
currentAnimation->addSpriteFrameWithFileName("yes5.png");
currentAnimation->addSpriteFrameWithFileName("yes6.png");
currentAnimation->addSpriteFrameWithFileName("yes6.png");
currentAnimation->addSpriteFrameWithFileName("yes6.png");
currentAnimation->addSpriteFrameWithFileName("yes6.png");
currentAnimation->addSpriteFrameWithFileName("yes6.png");
currentAnimation->addSpriteFrameWithFileName("yes6.png");
currentAnimation->addSpriteFrameWithFileName("yes6.png");
currentAnimation->addSpriteFrameWithFileName("yes6.png");
currentAnimation->addSpriteFrameWithFileName("yes6.png");
currentAnimation->addSpriteFrameWithFileName("yes6.png");
currentAnimation->addSpriteFrameWithFileName("yes6.png");
currentAnimation->addSpriteFrameWithFileName("yes6.png");
currentAnimation->addSpriteFrameWithFileName("yes6.png");
currentAnimation->addSpriteFrameWithFileName("yes6.png");
currentAnimation->addSpriteFrameWithFileName("yes6.png");
currentAnimation->addSpriteFrameWithFileName("yes6.png");
currentAnimation->addSpriteFrameWithFileName("wait7.png");
currentAnimation->addSpriteFrameWithFileName("wait8.png");
currentAnimation->addSpriteFrameWithFileName("wait9.png");
currentAnimation->addSpriteFrameWithFileName("wait10.png");
currentAnimation->addSpriteFrameWithFileName("wait11.png");
currentAnimation->addSpriteFrameWithFileName("wait12.png");
currentAnimation->addSpriteFrameWithFileName("wait11.png");
currentAnimation->addSpriteFrameWithFileName("wait10.png");
currentAnimation->addSpriteFrameWithFileName("wait9.png");
currentAnimation->addSpriteFrameWithFileName("wait8.png");
currentAnimation->addSpriteFrameWithFileName("wait9.png");
currentAnimation->addSpriteFrameWithFileName("wait10.png");
currentAnimation->addSpriteFrameWithFileName("wait11.png");
currentAnimation->addSpriteFrameWithFileName("wait12.png");
currentAnimation->addSpriteFrameWithFileName("wait11.png");
currentAnimation->addSpriteFrameWithFileName("wait10.png");
currentAnimation->addSpriteFrameWithFileName("wait9.png");
currentAnimation->addSpriteFrameWithFileName("wait8.png");
currentAnimation->addSpriteFrameWithFileName("wait7.png");
currentAnimation->addSpriteFrameWithFileName("wait6.png");
currentAnimation->addSpriteFrameWithFileName("wait5.png");
currentAnimation->addSpriteFrameWithFileName("wait4.png");
currentAnimation->addSpriteFrameWithFileName("wait3.png");
currentAnimation->addSpriteFrameWithFileName("wait2.png");
currentAnimation->addSpriteFrameWithFileName("wait1.png");
currentAnimation->addSpriteFrameWithFileName("wait2.png");
currentAnimation->addSpriteFrameWithFileName("wait3.png");
currentAnimation->addSpriteFrameWithFileName("wait4.png");
currentAnimation->addSpriteFrameWithFileName("wait5.png");
currentAnimation->addSpriteFrameWithFileName("wait4.png");
currentAnimation->addSpriteFrameWithFileName("wait3.png");
currentAnimation->addSpriteFrameWithFileName("wait2.png");
currentAnimation->addSpriteFrameWithFileName("wait1.png");
currentAnimation->addSpriteFrameWithFileName("wait2.png");
currentAnimation->addSpriteFrameWithFileName("wait3.png");
currentAnimation->addSpriteFrameWithFileName("wait4.png");
currentAnimation->addSpriteFrameWithFileName("wait5.png");
currentAnimation->addSpriteFrameWithFileName("wait6.png");
currentAnimation->addSpriteFrameWithFileName("wait7.png");
currentAnimation->addSpriteFrameWithFileName("wait8.png");
currentAnimation->addSpriteFrameWithFileName("wait9.png");
currentAnimation->addSpriteFrameWithFileName("wait10.png");
currentAnimation->addSpriteFrameWithFileName("wait11.png");
currentAnimation->addSpriteFrameWithFileName("wait12.png");
currentAnimation->addSpriteFrameWithFileName("wait11.png");
currentAnimation->addSpriteFrameWithFileName("wait10.png");
currentAnimation->addSpriteFrameWithFileName("wait9.png");
currentAnimation->addSpriteFrameWithFileName("wait8.png");
currentAnimation->addSpriteFrameWithFileName("wait9.png");
currentAnimation->addSpriteFrameWithFileName("wait10.png");
currentAnimation->addSpriteFrameWithFileName("wait11.png");
currentAnimation->addSpriteFrameWithFileName("wait12.png");
currentAnimation->addSpriteFrameWithFileName("wait11.png");
currentAnimation->addSpriteFrameWithFileName("wait10.png");
currentAnimation->addSpriteFrameWithFileName("wait9.png");
currentAnimation->addSpriteFrameWithFileName("wait8.png");
currentAnimation->addSpriteFrameWithFileName("wait7.png");
currentAnimation->addSpriteFrameWithFileName("wait6.png");
currentAnimation->addSpriteFrameWithFileName("wait5.png");
currentAnimation->addSpriteFrameWithFileName("wait4.png");
currentAnimation->addSpriteFrameWithFileName("wait3.png");
currentAnimation->addSpriteFrameWithFileName("wait2.png");
currentAnimation->addSpriteFrameWithFileName("wait1.png");
currentAnimation->addSpriteFrameWithFileName("wait2.png");
currentAnimation->addSpriteFrameWithFileName("wait3.png");
currentAnimation->addSpriteFrameWithFileName("wait4.png");
currentAnimation->addSpriteFrameWithFileName("wait5.png");
currentAnimation->addSpriteFrameWithFileName("wait4.png");
currentAnimation->addSpriteFrameWithFileName("wait3.png");
currentAnimation->addSpriteFrameWithFileName("wait2.png");
CCAnimate* animate = CCAnimate::create(currentAnimation);
//CCRepeatForever* repeat = CCRepeatForever::create(animate);
animate->setTag(333);
sprite->runAction(animate);
//.........这里部分代码省略.........