Separated path code from sprite code so that we can have other things

follow a path (specifically, I want to allow the media panel to be
"scrolled" along a path).


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1409 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2002-05-31 03:38:03 +00:00
parent f448ebe4f1
commit ccbc47a7de
12 changed files with 133 additions and 122 deletions
@@ -1,5 +1,5 @@
//
// $Id: IsoSceneView.java,v 1.109 2002/05/30 22:21:51 ray Exp $
// $Id: IsoSceneView.java,v 1.110 2002/05/31 03:38:03 mdb Exp $
package com.threerings.miso.scene;
@@ -26,8 +26,8 @@ import com.samskivert.util.HashIntMap;
import com.threerings.media.RegionManager;
import com.threerings.media.sprite.Path;
import com.threerings.media.sprite.SpriteManager;
import com.threerings.media.util.Path;
import com.threerings.media.tile.ObjectTile;
import com.threerings.media.tile.Tile;
@@ -1,5 +1,5 @@
//
// $Id: SceneView.java,v 1.27 2002/04/23 01:18:17 mdb Exp $
// $Id: SceneView.java,v 1.28 2002/05/31 03:38:03 mdb Exp $
package com.threerings.miso.scene;
@@ -8,7 +8,7 @@ import java.awt.Point;
import java.awt.Rectangle;
import java.awt.event.MouseEvent;
import com.threerings.media.sprite.Path;
import com.threerings.media.util.Path;
/**
* The scene view interface provides an interface to be implemented by
@@ -1,23 +1,25 @@
//
// $Id: TilePath.java,v 1.4 2002/03/16 03:15:05 shaper Exp $
// $Id: TilePath.java,v 1.5 2002/05/31 03:38:03 mdb Exp $
package com.threerings.miso.scene;
import java.awt.*;
import java.util.List;
import com.threerings.media.sprite.*;
import com.threerings.util.DirectionCodes;
import com.threerings.media.util.LineSegmentPath;
import com.threerings.media.util.PathNode;
import com.threerings.media.util.Pathable;
import com.threerings.miso.Log;
import com.threerings.miso.scene.util.IsoUtil;
/**
* The tile path represents a path of tiles through a scene. The path
* is traversed by treating each pair of connected tiles as a line
* segment. Only ambulatory sprites can follow a tile path, and their
* tile coordinates are updated as the path is traversed.
* The tile path represents a path of tiles through a scene. The path is
* traversed by treating each pair of connected tiles as a line segment.
* Only ambulatory sprites can follow a tile path, and their tile
* coordinates are updated as the path is traversed.
*/
public class TilePath extends LineSegmentPath
implements DirectionCodes
@@ -44,13 +46,13 @@ public class TilePath extends LineSegmentPath
}
// documentation inherited
public boolean updatePosition (Sprite sprite, long timestamp)
public boolean tick (Pathable pable, long timestamp)
{
boolean moved = super.updatePosition(sprite, timestamp);
boolean moved = super.tick(pable, timestamp);
if (moved) {
MisoCharacterSprite mcs = (MisoCharacterSprite)sprite;
int sx = sprite.getX(), sy = sprite.getY();
MisoCharacterSprite mcs = (MisoCharacterSprite)pable;
int sx = mcs.getX(), sy = mcs.getY();
Point pos = new Point();
// check whether we've arrived at the destination tile
@@ -1,9 +1,9 @@
//
// $Id: TilePathNode.java,v 1.1 2001/10/24 00:55:08 shaper Exp $
// $Id: TilePathNode.java,v 1.2 2002/05/31 03:38:03 mdb Exp $
package com.threerings.miso.scene;
import com.threerings.media.sprite.PathNode;
import com.threerings.media.util.PathNode;
/**
* The tile path nodes extends the path node class to allow