Fixed oscillations for real
Entities do not move after completing their moves...
This commit is contained in:
parent
e1f23f67a2
commit
b85d46e450
1 changed files with 4 additions and 4 deletions
|
@ -23,10 +23,13 @@ void Rule::update()
|
|||
if (targetState == State::Moving || targetState == State::Fleeing)
|
||||
{
|
||||
pro_maat::GridPos target = findTarget();
|
||||
if(target != previousPosition || entity->getPosition() != previousTarget)
|
||||
if(target != previousPosition && (entity->getPosition() != previousTarget || entity->getPosition() == previousPosition))
|
||||
{
|
||||
entity->nextTarget = target;
|
||||
entity->nextState = targetState;
|
||||
|
||||
previousPosition = entity->getPosition();
|
||||
previousTarget = entity->getTarget();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -47,9 +50,6 @@ void Rule::update()
|
|||
entity->nextState = State::Idle;
|
||||
entity->update();
|
||||
}
|
||||
|
||||
previousPosition = entity->getPosition();
|
||||
previousTarget = entity->getTarget();
|
||||
}
|
||||
|
||||
pro_maat::GridPos Rule::findTarget()
|
||||
|
|
Loading…
Add table
Reference in a new issue