Ignore path nodes if we're already there.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@170 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// $Id: Sprite.java,v 1.6 2001/08/02 20:43:03 shaper Exp $
|
// $Id: Sprite.java,v 1.7 2001/08/04 00:36:33 shaper Exp $
|
||||||
|
|
||||||
package com.threerings.miso.sprite;
|
package com.threerings.miso.sprite;
|
||||||
|
|
||||||
@@ -161,6 +161,12 @@ public class Sprite
|
|||||||
|
|
||||||
Log.info("moveAlongPath [dest=" + _dest + "].");
|
Log.info("moveAlongPath [dest=" + _dest + "].");
|
||||||
|
|
||||||
|
// if we're already here, move on to the next node
|
||||||
|
if (x == _dest.loc.x && y == _dest.loc.y) {
|
||||||
|
moveAlongPath();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// determine the horizontal/vertical move increments
|
// determine the horizontal/vertical move increments
|
||||||
float dist = MathUtil.distance(x, y, _dest.loc.x, _dest.loc.y);
|
float dist = MathUtil.distance(x, y, _dest.loc.x, _dest.loc.y);
|
||||||
_incx = (float)(_dest.loc.x - x) / dist;
|
_incx = (float)(_dest.loc.x - x) / dist;
|
||||||
|
|||||||
Reference in New Issue
Block a user