//让精灵动起来,并改变方向
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));
}
}