newlist

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::
//让精灵动起来,并改变方向
void EnemyBase::changeDirection(float dt)  
{  
    auto curr = currPoint();  
    if(curr->getPositionX() > this->getPosition().x )  
    {  
        runAction( Animate::create(AnimationCache::getInstance()->getAnimation("runright"))) ;  
    }else{  
        runAction( Animate::create(AnimationCache::getInstance()->getAnimation("runleft"))  );  
    }  
}
//敌人前进的动画
void EnemyBase::runFllowPoint()  
{  
    auto point = currPoint();  
    setPosition(point->getPosition());  
    point = nextPoint();     
    if( point!= NULL ){  
        runAction(CCSequence::create(MoveTo::create(getRunSpeed(), point->getPosition())  
                                        , CallFuncN::create(CC_CALLBACK_0(EnemyBase::runFllowPoint, this))  
                                        , NULL));  
    }  
}

 

posted on 2014-11-27 15:54  一枚程序  阅读(209)  评论(0编辑  收藏  举报