当前位置: 首页>>代码示例>>C++>>正文


C++ CCAnimate::setTag方法代码示例

本文整理汇总了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;
}
开发者ID:TanCYA,项目名称:FishingJoy,代码行数:12,代码来源:Fish.cpp

示例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;
}
开发者ID:RainbowMin,项目名称:projects,代码行数:16,代码来源:Fish.cpp

示例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);
    }
}
开发者ID:KAndQ,项目名称:cocos2dx-utils,代码行数:17,代码来源:AvatarComponent.cpp

示例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);
    }
}
开发者ID:KAndQ,项目名称:cocos2dx-utils,代码行数:36,代码来源:AvatarComponent.cpp

示例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);
//.........这里部分代码省略.........
开发者ID:huynhthang,项目名称:Project_cpp,代码行数:101,代码来源:Player.cpp


注:本文中的CCAnimate::setTag方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。