コード例 #1
0
ファイル: entity.cpp プロジェクト: Sryder13/Dung3on
entity::entity(int x, int y, const std::string &modelFilename, gamemap *currentmap)
{
	setX(x);
	setY(y);
	setFacing(DIR_NORTH);
	setEntityModel(modelFilename);
}
コード例 #2
0
ファイル: Ant.cpp プロジェクト: aliceresearch/MAGPIE
void Ant::turn(bool left)
{
    int newDir = left ? (getFacing() - 1 + 4) % 4 : (getFacing() + 1 + 4) % 4;
    setFacing((Ant::Facing) newDir);

    moves++;
}
コード例 #3
0
ファイル: entity.cpp プロジェクト: Sryder13/Dung3on
void player::update(gamemap *currentmap, controls gameControls)
{
	if (gameControls.getPressedButtons() & BUTTON_UP && !(gameControls.getHeldButtons() & BUTTON_UP))
	{
		if (!currentmap->dirIsType(DIR_NORTH, TILE_WALL, getX(), getY()))
		{
			setY(getY()-1);
			setFacing(DIR_NORTH);
		}
	}
	else if (gameControls.getPressedButtons() & BUTTON_RIGHT && !(gameControls.getHeldButtons() & BUTTON_RIGHT))
	{
		if (!currentmap->dirIsType(DIR_EAST, TILE_WALL, getX(), getY()))
		{
			setX(getX()+1);
			setFacing(DIR_EAST);
		}
	}
	else if (gameControls.getPressedButtons() & BUTTON_DOWN && !(gameControls.getHeldButtons() & BUTTON_DOWN))
	{
		if (!currentmap->dirIsType(DIR_SOUTH, TILE_WALL, getX(), getY()))
		{
			setY(getY()+1);
			setFacing(DIR_SOUTH);
		}
	}
	else if (gameControls.getPressedButtons() & BUTTON_LEFT && !(gameControls.getHeldButtons() & BUTTON_LEFT))
	{
		if (!currentmap->dirIsType(DIR_WEST, TILE_WALL, getX(), getY()))
		{
			setX(getX()-1);
			setFacing(DIR_WEST);
		}
	}

	if (currentmap->tileIsType(TILE_STAIRS, getX(), getY()))
		currentmap->generateMap();
}
コード例 #4
0
ファイル: HeroBase.cpp プロジェクト: 37947538/Young3_7
//更新英雄输出数据
void HeroBase::updateAIOutData(BTNodeOutputData *data)
{
    //处理技能按钮reset
    if (m_InputData->m_PlayerControl) {
        m_InputData->m_PlayerControl->resetSkillButton();
    }
    m_vVelocity=data->m_vVelocity;
    setFacing(data->m_NextFacing);
    m_InputData->m_CurrentFacing=data->m_NextFacing;
   
    while (!data->m_OutEvent.empty()) {
        BaseActionEvent* event=data->m_OutEvent.front();
        data->m_OutEvent.eraseObject(event);
        
        switch (event->getBaseActionEvent()) {
            case GameEnum::BaseActionEventType::PlayAnimate:                    //播放动画
            {
                std::string animateName=((__String*)event->getEventArg())->getCString();
                changeState(event->getEventBodyState(), animateName);
            }break;
            case GameEnum::BaseActionEventType::BeAttack:                       //被攻击
            {
                //auto hero=(HeroBase*)event->getEventArg();
                //subBlood(hero);
            }break;
            case GameEnum::BaseActionEventType::ChangeStateIdle:                //切换空闲状态
            {
                idleAnimate();
                //m_CurrState=GameEnum::EnemyState::Idle;
            }break;
            case GameEnum::BaseActionEventType::ChangeShaderBeAttackShader:    //切换被打特效
            {
                onShaderChange(GameEnum::EnemyEvent::EventChangeShaderBeAttackShader);
            }break;
           
            default:
                break;
        }
         
        //销毁事件
        data->m_OutEvent.eraseObject(event);
    }
}
コード例 #5
0
void BuddyPlayer::act( vector< Object * > * others, World * world, vector< Object * > * add ){
    Character::act(others, world, add);

    if (show_life > getHealth()){
        show_life--;
    }

    if (show_life < getHealth()){
        show_life++;
    }

    vector<Object *> enemies;

    if (getStatus() != Status_Ground && getStatus() != Status_Jumping){
        return;
    }

    filterEnemies(enemies, others);

    if (animation_current->Act()){
        animation_current->reset();
        // nextTicket();
        // animation_current = movements[ "idle" ];
        animation_current = getMovement("idle");
        animation_current->reset();
    }

    if (animation_current == getMovement("idle") ||
        animation_current == getMovement("walk") ){
        if (enemies.empty() && want_x == -1 && want_z == -1 && Util::rnd(15) == 0){
            // want_x = Util::rnd( 100 ) - 50 + furthestFriend( others, getAlliance(), this );
            want_x = Util::rnd(100) - 50 + (int) leader->getX();
            want_z = Util::rnd(world->getMinimumZ(), world->getMaximumZ());
        } else if (! enemies.empty()){
            const Object * main_enemy = findClosest(enemies);
            if ( main_enemy->getX() > getX() ){
                want_x = (int)(main_enemy->getX() - 20 - Util::rnd(20));
            } else {
                want_x = (int)(main_enemy->getX() + 20 + Util::rnd(20));
            }
            if (want_x < 1){
                want_x = Util::rnd(100) - 50 + (int) leader->getX();
            }
            want_z = (int)(Util::rnd(3) - 1 + main_enemy->getZ());
            faceObject(main_enemy);

            if (Util::rnd(35) == 0){
                vector<Util::ReferenceCount<Animation> > attacks;
                for (map<string, Util::ReferenceCount<Animation> >::const_iterator it = getMovements().begin(); it != getMovements().end(); it++){
                    Util::ReferenceCount<Animation> maybe = (*it).second;
                    if (maybe->isAttack() && maybe->getStatus() == Status_Ground && maybe->getName() != "special"){
                        attacks.push_back(maybe);
                    }
                }

                double attack_range = fabs( getX() - main_enemy->getX() );
                double zdistance = ZDistance( main_enemy );
                for (vector<Util::ReferenceCount<Animation> >::iterator it = attacks.begin(); it != attacks.end(); /**/){
                    Util::ReferenceCount<Animation> maybe = *it;
                    if (attack_range > maybe->getRange() || zdistance > maybe->getMinZDistance()){
                        it = attacks.erase(it);
                    } else {
                        it++;
                    }
                }

                if (!attacks.empty()){
                    animation_current = attacks[Util::rnd(attacks.size())];
                    world->addMessage(animationMessage());
                    nextTicket();
                    animation_current->reset();
                    return;
                } else {
                }
            }
        }

        if (want_x != -1 && want_z != -1){
            bool walk = false;
            if (want_x < 1){
                want_x = 1;
            }
            if (want_z < world->getMinimumZ()){
                want_z = world->getMinimumZ() + 1;
            }
            if (want_z >= world->getMaximumZ()){
                want_z = world->getMaximumZ() - 1;
            }
            if (getX() - want_x < -2){
                moveX(getSpeed());
                setFacing(FACING_RIGHT);
                walk = true;
            } else if (getX() - want_x > 2){
                setFacing(FACING_LEFT);
                moveX(getSpeed());
                walk = true;
            }

            if (getZ() < want_z){
                moveZ(getSpeed());
                walk = true;
            } else if (getZ() > want_z){
                moveZ(-getSpeed());
                walk = true;
            }

            if (walk){
                animation_current = getMovement("walk");
            }

            if (fabs(getX() - want_x) <= 2 &&
                fabs(getZ() - want_z) <= 2){
                want_x = -1;
                want_z = -1;
                animation_current = getMovement("idle");
            }
        }
    }
}
コード例 #6
0
ファイル: Player.cpp プロジェクト: Zyrst/Fallen-Stars
void Player::update(sf::Time deltaTime)
{
	float maxVel = 3.0f;
	const b2Vec2& vel = body->GetLinearVelocity();
	if(hitTimer.getElapsedTime().asSeconds() <= 3.0f)
	{
		leftHitCollision->setActive(false);
		rightHitCollision->setActive(false);
	}
	else
	{
		leftHitCollision->setActive(true);
		rightHitCollision->setActive(true);
	}

	if(rightHitCollision->isHitColliding() && rightHitCollision->isActive())
	{
		setFacing(RIGHT);
		hitTimer.restart();
		damaged();
	}
	if(leftHitCollision->isHitColliding()&& leftHitCollision->isActive())
	{
		setFacing(LEFT);
		hitTimer.restart();
		damaged();
	}
	if(shadeCollision->isHitColliding()&&!groundCallBack->isColliding() && state != GRABBING)
	{
		
		//For funtimes ;)
		//body->SetFixedRotation(false);
		if(getFacing() == LEFT)
		{
			body->ApplyForce(b2Vec2(knockForce,0.1f),b2Vec2(0.0f,0.0f),true);
		}
		else if(getFacing() == RIGHT)
		{
			body->ApplyForce(b2Vec2(-knockForce,0.1f),b2Vec2(0.0f,0.0f),true);
		}
		else{body->ApplyForce(b2Vec2(knockForce,0.1f),b2Vec2(0.0f,0.0f),true);}
		
		setState(KNOCKEDBACKED);
	}

	if (flashLight->isEnabled())
	{
		Shade* shade = flashLightCallBack->getClosestShade(flashLight->getPosition());
		if (shade)
		{
			Facing dir = (getFacing() == Facing::LEFT) ? RIGHT : LEFT;
			shade->increaseTimeInFlashLight(deltaTime.asSeconds());
			shade->setFacing(dir);
		}
	}

	switch(state)
	{
	case NORMAL:
	
		if ((!rightButton && !leftButton) || (rightButton && leftButton))
		{
			body->SetLinearVelocity(b2Vec2(0,vel.y));
		}
		else if (rightButton)
		{
			if (!rightSideCollision->isColliding() && vel.x < maxVel)
			{
				//body->SetLinearVelocity(b2Vec2(SPEED, vel.y));
				body->ApplyLinearImpulse(b2Vec2(0.8f,0.0f),b2Vec2(body->GetWorldCenter()),true);
			}
			
			setFacing(Entity::RIGHT);
		}
		else if (leftButton)
		{
			if (!leftSideCollision->isColliding() && vel.x > -maxVel)
			{
				//body->SetLinearVelocity(b2Vec2(-SPEED, vel.y));
				 body->ApplyLinearImpulse(b2Vec2(-0.8f,0.0f),b2Vec2(body->GetWorldCenter()),true);
			}

			setFacing(Entity::LEFT);
		}
		

		//Check for grabbing if we are not flying upwards.
		if (!groundCallBack->isColliding() && vel.y >= 0)
		{
			if (leftGrabCallBack->isColliding() && !leftAntiGrabCallBack->isColliding() && getFacing() == Facing::LEFT)
			{
				this->setState(PLAYER_STATE::GRABBING);
				const sf::FloatRect& bounds = leftGrabCallBack->getGrabbedFixtureBounds();
				body->SetTransform(Convert::sfmlToB2(sf::Vector2f(bounds.left + bounds.width + (bodyBounds.width / 2.0f), bounds.top)), 0);
			}
			else if (rightGrabCallBack->isColliding() && !rightAntiGrabCallBack->isColliding() && getFacing() == Facing::RIGHT)
			{
				this->setState(PLAYER_STATE::GRABBING);
				const sf::FloatRect& bounds = rightGrabCallBack->getGrabbedFixtureBounds();
				body->SetTransform(Convert::sfmlToB2(sf::Vector2f(bounds.left-(bodyBounds.width/2.0f), bounds.top)), 0);
			}
		}
		
	break;
	case GRABBING:
	
		//Check if we should just drop down
		//Jumping while grabbing is handled in Player::jump() and not here.
		if (downButton || (rightButton && getFacing() == Facing::LEFT) || (leftButton && getFacing() == Facing::RIGHT))
		{
			const float pushDistance = 12.0f;
			//If we are facing right, push the player a bit left
			if (getFacing() == Facing::RIGHT)
			{
				sf::Vector2f pos = Convert::b2ToSfml(body->GetPosition());
				pos.x -= pushDistance;
				body->SetTransform(Convert::sfmlToB2(pos), 0.0f);
				setFacing(Entity::LEFT);
			}
			//Else just push the player a bit right.
			else if (getFacing() == Facing::LEFT)
			{
				sf::Vector2f pos = Convert::b2ToSfml(body->GetPosition());
				pos.x += pushDistance;
				body->SetTransform(Convert::sfmlToB2(pos), 0.0f);
				setFacing(Entity::RIGHT);
			}

			setState(PLAYER_STATE::NORMAL);
		}
	break;
	case DAMAGED:
	anime.setLooped(false);
	if(!anime.isFinished())
	{
		body->SetLinearVelocity(b2Vec2(0,0));
	}
	if(anime.isFinished())
	{
		setState(NORMAL);
		anime.setLooped(true);
	}
	if(mStats.health <=0)
	{
		setState(DYING);
	}
	break;
	case KNOCKEDBACKED:
		if(mStats.health <=0){setState(DYING);}
		else if (knockedbackClock.getElapsedTime().asSeconds() > 1)
		{
			setState(NORMAL);
		}
		break;
	case DYING:
		mPlatformState.getOverlay(PlatformState::DEATH_SCREEN).setEnabled(true);
		std::cout<<"Waaaaaaaaaaaah"<<std::endl;
		std::cout<<"---------Player Dead----------"<<std::endl;
		break;
	default:
		break;
	}

	updateAnimation();
	updateSound();
	anime.update(deltaTime);
	updateFlashlightPosition();
}
コード例 #7
0
ファイル: cat.cpp プロジェクト: MortimerBlater/paintown
void Cat::act( vector< Object * > * others, World * world, vector< Object * > * add ){
	switch ( state ){
		case WALK : {
			moveX( -0.8 );
			if ( Util::rnd( 5 ) == 0 ){
				moveZ( -0.2 );
			}
			if ( Util::rnd( 5 ) == 0 ){
				moveZ( 0.2 );
			}
			break;
		}
		case RUN : {
			moveX( -2.2 );
			if ( Util::rnd( 5 ) == 0 ){
				moveZ( -0.2 );
			}
			if ( Util::rnd( 5 ) == 0 ){
				moveZ( 0.2 );
			}
			break;
		}
		default : {
			break;
		}
	}

	if ( current_animation->Act() ){
		switch ( state ){
			case IDLE1 :
			case IDLE2 : {
				switch ( Util::rnd( 5 ) ){
					case 0 : {
						state = IDLE1;
						current_animation = animations[ "idle1" ];
						break;
					}
					case 1 : {
						state = IDLE2;
						current_animation = animations[ "idle2" ];
						break;
					}
					case 2 :
					case 3 :
					case 4 : {
						state = YAWN;
						current_animation = animations[ "yawn" ];
						if ( Util::rnd( 2 ) == 0 ){
							setFacing( getOppositeFacing() );
						}
						break;
					}
					default : {
						break;
					}
				}
				break;
			}
			case YAWN : {
				switch ( Util::rnd( 6 ) ){
					case 0 :
					case 1 : {
						state = SIT;
						current_animation = animations[ "sit" ];
						break;
					}
					case 2 :
					case 3 :
					case 4 :
					case 5 : {
						state = WALK;
						current_animation = animations[ "walk" ];
						break;
					}
				}
				break;
			}
			case WALK : {
				switch ( Util::rnd( 12 ) ){
					case 0 : {
						state = SIT;
						current_animation = animations[ "sit" ];
						break;
					}
					case 1 :
					case 2 :
					case 3 : {
						state = TURN;
						current_animation = animations[ "turn" ];
						break;
					}
					case 4 :
					case 5 : {
						state = RUN;
						current_animation = animations[ "run" ];
					}
					default : {
					}
				}
				break;
			}
			case SIT : {
				switch ( Util::rnd( 2 ) ){
					case 0 : {
						state = IDLE1;
						current_animation = animations[ "idle1" ];
						break;
					}
					case 1 : {
						state = IDLE2;
						current_animation = animations[ "idle2" ];
						break;
					}
				}
				break;
			}
			case TURN : {
				setFacing( getOppositeFacing() );
				state = WALK;
				current_animation = animations[ "walk" ];
				break;
			}
			case RUN : {
				switch ( Util::rnd( 4 ) ){
					case 0 : {
						state = WALK;
						current_animation = animations[ "walk" ];
						break;
					}
					default : {
					}
				}
				break;
			}
		}
		current_animation->reset();
	}
}
コード例 #8
0
ファイル: character.cpp プロジェクト: St0rmcrow/scummvm
void Character::update(int32 timeIncrement) {
	debugC(5, kDebugCharacter, "update(%d)", timeIncrement);
	if ((_flags & 0x1) && _currentPathNodeCount > 0) {
		if (_currentPathNode < _currentPathNodeCount) {
			if (_currentPathNode < _currentPathNodeCount - 10) {
				int32 delta = MIN<int32>(10, _currentPathNodeCount - _currentPathNode);
				int32 dx = _currentPathX[_currentPathNode+delta] - _x;
				int32 dy = _currentPathY[_currentPathNode+delta] - _y;
				setFacing(getFacingFromDirection(dx, dy));
				playWalkAnim(0, 0);
			}

			// in 1/1000 pixels
			_numPixelToWalk += _speed * (_vm->getSystem()->getMillis() - _lastWalkTime) * _scale / 1024;
			_lastWalkTime =  _vm->getSystem()->getMillis();

			while (_numPixelToWalk > 1000 && _currentPathNode < _currentPathNodeCount) {
				_x = _currentPathX[_currentPathNode];
				_y = _currentPathY[_currentPathNode];
				_currentPathNode += 1;
				_numPixelToWalk -= 1000;
			}
			setPosition(_x, _y);
		} else {
			playStandingAnim();
			_flags &= ~0x1;
			_currentPathNodeCount = 0;
		}
	}

	updateIdle();

#if 0
	// handle special anims
	if ((_flags & 4) == 0)
		return;

	if (_animScriptId != -1) {
		_animationInstance = _vm->getSceneAnimation(this->)
#endif

	int32 animId = _animSpecialId;
	if (animId >= 1000)
		animId = 0;

	if (_animSpecialId < 0)
		return;

	int32 currentFrame = _animationInstance->getFrame();

	const SpecialCharacterAnimation *anim = getSpecialAnimation(_id, animId);

	if ((_animFlags & 0x10) == 0) {
		if (_animScriptId != -1 && currentFrame > 0 && !_vm->getSceneAnimationScript(_animScriptId)->_frozen) {
			if (_vm->getCurrentLineToSay() != _lineToSayId && (_animFlags & 8))
				stopSpecialAnim();
			return;
		}

		if (_id == 1 && (_animFlags & 4)) {
			if (_animFlags & 0x10)
				return;
		} else {
			if (_id == 1 && (_animFlags & 0x10) && _vm->getCurrentLineToSay() != -1) {
				return;
			}
			if ((_animFlags & 0x40) == 0 && _vm->getCurrentLineToSay() == -1) {
				stopSpecialAnim();
				return;
			}

			if (_animScriptId != -1)
				_vm->getSceneAnimationScript(_animScriptId)->_frozenForConversation = true;

			// TODO setup backup //

			_animFlags |= 0x10;
			_animationInstance->setAnimation(_specialAnim);
			_animationInstance->setFrame(0);
			_time = _vm->getOldMilli() + 8 * _vm->getTickLength();
		}

	}

	if ((_animFlags & 3) == 2) {
		if ((((_animFlags & 8) == 8) && _vm->getCurrentLineToSay() != _lineToSayId) || !_vm->getAudioManager()->voiceStillPlaying())  // || (_flags & 8)) && _vm->getAudioManager()->voiceStillPlaying())
			_animFlags |= 1;

	}

	if (_time > _vm->getOldMilli())
		return;

	int32 animFlag = anim->_unused;
	int32 nextFrame = currentFrame + 1;
	int32 nextTime = _time;
	int32 animDir = 1;
	if (!animFlag) {
		if (_animFlags & 1) {
			if (anim->_flags7 == 0xff) {
				if (currentFrame > anim->_flag1 / 2)
					animDir = 1;
				else
					animDir = -1;
			} else {
				if (currentFrame >= anim->_flags6) {
					if (currentFrame < anim->_flags7)
						currentFrame = anim->_flags7;
				}
				if (currentFrame > anim->_flags6)
					animDir = 1;
				else
					animDir = -1;
			}

			nextFrame = currentFrame + animDir;
			nextTime = _vm->getOldMilli() + 6 * _vm->getTickLength();
		} else {
			if (_animFlags & 0x20) {
				nextFrame = currentFrame - 1;
				if (nextFrame == anim->_flags6 - 1) {
					if (anim->_flags8 != 1 && (_vm->randRange(0, 1) == 1 || anim->_flags8 == 2)) {
						_animFlags &= ~0x20;
						nextFrame += 2;
						if (nextFrame > anim->_flags7)
							nextFrame = anim->_flags7;
					} else {
						nextFrame = anim->_flags7;
					}
				}
			} else {
				nextFrame = currentFrame + 1;
				if (nextFrame == anim->_flags7 + 1 && (_animFlags & 0x40) == 0) {
					if (anim->_flags8 != 1 && (_vm->randRange(0, 1) || anim->_flags8 == 2)) {
						_animFlags |= 0x20;
						nextFrame -= 2;
						if (nextFrame < anim->_flags6)
							nextFrame = anim->_flags6;
					} else {
						nextFrame = anim->_flags6;
					}
				}
			}

			nextTime = _vm->getOldMilli() + 8 * _vm->getTickLength();
		}
		// goto label78
	}
	// skipped all this part.

	//label78

#if 0
	if (_id == 0)
		debug(" drew animation name %s / flag %d / frame %d", _specialAnim->_name, _animFlags, nextFrame);
	if (_id == 1)
		debug(" flux animation flag %d / frame %d", _animFlags, nextFrame);
	if (_id == 7)
		debug(" footman animation flag %d / frame %d", _animFlags, nextFrame);
#endif

	_time = nextTime;
	if (nextFrame < 0 || nextFrame >= anim->_flag1) {
		if ((_animFlags & 2) == 0 || _vm->getCurrentLineToSay() != _lineToSayId) {
			stopSpecialAnim();
			return;
		}

		// lots skipped here

		_animFlags &= ~0x10;
		_animationInstance->forceFrame(0);
		return;

	}

	//if ((_flags & 8) == 0 || !_vm->getAudioManager()->voiceStillPlaying( ) || )
	_animationInstance->forceFrame(nextFrame);
}
コード例 #9
0
ファイル: character.cpp プロジェクト: St0rmcrow/scummvm
bool Character::walkTo(int32 newPosX, int32 newPosY) {
	debugC(1, kDebugCharacter, "walkTo(%d, %d)", newPosX, newPosY);

	if (!_visible)
		return true;

	if (_x == newPosX && _y == newPosY)
		return true;

	_vm->getPathFinding()->resetBlockingRects();

	// don't allow flux to go at the same position as drew
	if (_id == 1 ) {
		int32 sizeX = MAX<int32>(5, 30 * _vm->getDrew()->getScale() / 1024);
		int32 sizeY = MAX<int32>(2, 20 * _vm->getDrew()->getScale() / 1024);
		_vm->getPathFinding()->addBlockingEllipse(_vm->getDrew()->getFinalX(), _vm->getDrew()->getFinalY(), sizeX, sizeY);
	}

	_vm->getPathFinding()->findClosestWalkingPoint(newPosX, newPosY, &_finalX, &_finalY, _x, _y);
	if (_x == _finalX && _y == _finalY)
		return true;

	if (_vm->getPathFinding()->findPath(_x, _y, _finalX, _finalY)) {

		int32 localFinalX = _finalX;
		int32 localFinalY = _finalY;
		int32 smoothDx = 0;
		int32 smoothDy = 0;

		for (int32 a = 0; a < _vm->getPathFinding()->getPathNodeCount(); a++) {
			_currentPathX[a] = _vm->getPathFinding()->getPathNodeX(a);
			_currentPathY[a] = _vm->getPathFinding()->getPathNodeY(a);
		}
		_currentPathNodeCount = _vm->getPathFinding()->getPathNodeCount();
		_currentPathNode = 0;
		stopSpecialAnim();

		_lastWalkTime = _vm->getSystem()->getMillis();

		_numPixelToWalk = 0;

		_flags |= 0x1;

		_currentWalkStamp++;

		int32 localWalkStamp = _currentWalkStamp;

		if (_blockingWalk) {
			while ((_x != newPosX || _y != newPosY) && _currentPathNode < _currentPathNodeCount && !_vm->shouldQuitGame()) {
				if (_currentPathNode < _currentPathNodeCount - 4) {
					int32 delta = MIN<int32>(4, _currentPathNodeCount - _currentPathNode);

					int32 dx = _currentPathX[_currentPathNode+delta] - _x;
					int32 dy = _currentPathY[_currentPathNode+delta] - _y;

					// smooth the facing computation. It prevents some ugly flickering from happening
					if (!smoothDx && !smoothDy) {
						smoothDx = dx;
						smoothDy = dy;
					} else {
						smoothDx = (dx + smoothDx * 3) / 4;
						smoothDy = (dy + smoothDy * 3) / 4;
					}

					setFacing(getFacingFromDirection(smoothDx, smoothDy));
					playWalkAnim(0, 0);
				}

				// in 1/1000 pixels
				_numPixelToWalk += _speed * (_vm->getSystem()->getMillis() - _lastWalkTime) * _scale / 1024;
				_lastWalkTime =  _vm->getSystem()->getMillis();

				while (_numPixelToWalk >= 1000 && _currentPathNode < _currentPathNodeCount) {
					_x = _currentPathX[_currentPathNode];
					_y = _currentPathY[_currentPathNode];
					_currentPathNode += 1;
					_numPixelToWalk -= 1000;
				}
				setPosition(_x, _y);

				_vm->doFrame();
				if (_currentWalkStamp != localWalkStamp) {
					// another walkTo was started in doFrame, we need to cancel this one.
					return false;
				}

			}
			playStandingAnim();
			_flags &= ~0x1;
			_currentPathNode = 0;
			_currentPathNodeCount = 0;

			if (_x != localFinalX || _y != localFinalY) {
				return false;
			}
		}
	}

	return true;
}