本文整理汇总了C++中Spawn::setTag方法的典型用法代码示例。如果您正苦于以下问题:C++ Spawn::setTag方法的具体用法?C++ Spawn::setTag怎么用?C++ Spawn::setTag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Spawn
的用法示例。
在下文中一共展示了Spawn::setTag方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setHeroStatus
void HeroFrog::setHeroStatus(FrogStatus heroStatus){
if (m_heroStatus == heroStatus) {
return;
}
m_heroStatus = heroStatus;
Animation* ani;
Animate* ac;
this->stopAllActions();
ani = AnimationCache::getInstance()->getAnimation(animaName[heroStatus].c_str());
Animation* ani1;
Animate* ac1;
if (heroStatus == frogJumpDown) {
ani1 = AnimationCache::getInstance()->getAnimation(animaName[heroStatus+1].c_str());
}else if (heroStatus == frogJumpUp&& m_isLongJump){
std::string aniName = animaName[8].c_str();
ani = AnimationCache::getInstance()->getAnimation(aniName);
}
Sequence* seq;
float y;
float dis;
float time;
SpriteFrame* deadFrame ;
Spawn* sp;
MoveTo* mvTo;
Point targetPoint;
// CCLOG("---------设置hero状态-----------");
switch (heroStatus) {
case frogStatic:
GameMainHelper::getInstance()->playSound(JUMPOVER);
ac= Animate::create(ani) ;
runAction(RepeatForever::create(ac));
break;
case frogTakeoff:
ac= Animate::create(ani) ;
ani->setDelayPerUnit(0.2);
runAction(RepeatForever::create(ac));
break;
case frogJumpUp:
if(m_isLongJump)
GameMainHelper::getInstance()->playSound(JUMPSTART_1);
else
GameMainHelper::getInstance()->playSound(JUMPSTART_0);
ani->setDelayPerUnit(0.2); //--------待计算
ac= Animate::create(ani);
runAction(RepeatForever::create(ac));
break;
case frogJumpDown:
ani->setDelayPerUnit(downAnimSpeed); //--------待计算
ani1->setDelayPerUnit(0.2);
ac= Animate::create(ani);
ac1 = Animate::create(ani1);
runAction(Sequence::create(ac,Repeat::create(ac1,20), NULL) );
break;
case frogFall:
ani->setDelayPerUnit(downAnimSpeed);
ac= Animate::create(ani);
targetPoint = GameMainHelper::getInstance()->getHeroPostPoint();
time =ani->getDelayPerUnit();
mvTo = MoveTo::create(downAnimSpeed,targetPoint);
sp = Spawn::create(ac,mvTo, NULL);
seq = Sequence::create(sp,CCCallFunc::create(CC_CALLBACK_0(HeroFrog::setHeroStatic, this)) , NULL);
runAction(seq);
break;
case frogDead1:
GameMainHelper::getInstance()->playSound(HEROOVER);
deadFrame = SpriteFrameCache::getInstance()->getSpriteFrameByName("hero_dead2.png");
this->setDisplayFrame(deadFrame);
ac= Animate::create(ani);
y = MIN(GameMainHelper::getInstance()->getEarthH(),getPositionY());
dis = getPositionY()-y;
time = dis/downSpeed;
targetPoint = Point(getPositionX(),y);
mvTo = MoveTo::create(time,targetPoint);
sp = Spawn::create(Repeat::create(ac,(int)(time/(0.2*3))),mvTo, NULL);
sp->setTag(DEAD1TAG);
seq = Sequence::create(DelayTime::create(0.5), sp,CCCallFunc::create(CC_CALLBACK_0(HeroFrog::stopAnimation, this)), NULL);
runAction(seq);
break;
case frogDead2:
GameMainHelper::getInstance()->playSound(HEROOVER);
ac= Animate::create(ani) ;
runAction(RepeatForever::create(ac));
break;
default:
ac= Animate::create(ani);
runAction(RepeatForever::create(ac));
//.........这里部分代码省略.........