diff --git a/core/Action/MoveBy.cpp b/core/Action/MoveBy.cpp index e4da97a6..5d14588d 100644 --- a/core/Action/MoveBy.cpp +++ b/core/Action/MoveBy.cpp @@ -14,7 +14,7 @@ void e2d::MoveBy::_init() if (_target) { - _startPos = _target->getPos(); + _prevPos = _startPos = _target->getPos(); } } @@ -24,7 +24,14 @@ void e2d::MoveBy::_update() if (_target) { - _target->setPos(_startPos + _deltaPos * _delta); + Point currentPos = _target->getPos(); + Vector diff = currentPos - _prevPos; + _startPos = _startPos + diff; + + Point newPos = _startPos + (_deltaPos * _delta); + _target->setPos(newPos); + + _prevPos = newPos; } } diff --git a/core/e2daction.h b/core/e2daction.h index de88ffb3..8b4bd63c 100644 --- a/core/e2daction.h +++ b/core/e2daction.h @@ -144,6 +144,7 @@ protected: protected: Point _startPos; + Point _prevPos; Vector _deltaPos; };