[Fix] Change calculation of absolute value to support floating point variables.
This commit is contained in:
parent
2e50097502
commit
61f1f2b2a4
@ -70,7 +70,7 @@ void NPC::Move(void) {
|
|||||||
|
|
||||||
if(_walkInPath && !_moving) {
|
if(_walkInPath && !_moving) {
|
||||||
Vec2 targetPos((float)_target->GetX(), (float)_target->GetY());
|
Vec2 targetPos((float)_target->GetX(), (float)_target->GetY());
|
||||||
if(abs(Vec2::Distance(targetPos, realPos)) <= CHARACTER_SPEED) {
|
if(fabs(Vec2::Distance(targetPos, realPos)) <= CHARACTER_SPEED) {
|
||||||
_target = _astar.GetSolutionNext();
|
_target = _astar.GetSolutionNext();
|
||||||
if(_target == NULL || _target == _lastTarget) {
|
if(_target == NULL || _target == _lastTarget) {
|
||||||
_walkInPath = false;
|
_walkInPath = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user