Make it possible for other kinds of sprites to know and report their tile
coordinates. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2004 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: IsoSceneView.java,v 1.125 2002/11/20 22:16:54 mdb Exp $
|
||||
// $Id: IsoSceneView.java,v 1.126 2002/11/28 03:42:17 mdb Exp $
|
||||
|
||||
package com.threerings.miso.scene;
|
||||
|
||||
@@ -385,10 +385,10 @@ public class IsoSceneView implements SceneView
|
||||
// if this is a miso character sprite, we can use its cached
|
||||
// tile coordinates
|
||||
int tx, ty;
|
||||
if (sprite instanceof MisoCharacterSprite) {
|
||||
MisoCharacterSprite mcs = (MisoCharacterSprite)sprite;
|
||||
tx = mcs.getTileX();
|
||||
ty = mcs.getTileY();
|
||||
if (sprite instanceof IsoSprite) {
|
||||
IsoSprite iso = (IsoSprite)sprite;
|
||||
tx = iso.getTileX();
|
||||
ty = iso.getTileY();
|
||||
|
||||
} else {
|
||||
// otherwise we have to compute them from the screen
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
//
|
||||
// $Id: IsoSprite.java,v 1.1 2002/11/28 03:42:17 mdb Exp $
|
||||
|
||||
package com.threerings.miso.scene;
|
||||
|
||||
/**
|
||||
* An interface implementable by sprites that know their tile coordinates
|
||||
* in the isometric view.
|
||||
*/
|
||||
public interface IsoSprite
|
||||
{
|
||||
/**
|
||||
* Returns the sprite's location on the x-axis in tile coordinates.
|
||||
*/
|
||||
public int getTileX ();
|
||||
|
||||
/**
|
||||
* Returns the sprite's location on the y-axis in tile coordinates.
|
||||
*/
|
||||
public int getTileY ();
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: MisoCharacterSprite.java,v 1.5 2002/07/08 21:41:30 mdb Exp $
|
||||
// $Id: MisoCharacterSprite.java,v 1.6 2002/11/28 03:42:17 mdb Exp $
|
||||
|
||||
package com.threerings.miso.scene;
|
||||
|
||||
@@ -17,7 +17,7 @@ import com.threerings.miso.tile.BaseTile;
|
||||
* will itself keep the sprite coordinates properly up to date.
|
||||
*/
|
||||
public class MisoCharacterSprite extends CharacterSprite
|
||||
implements Traverser
|
||||
implements Traverser, IsoSprite
|
||||
{
|
||||
// documentation inherited
|
||||
public boolean canTraverse (BaseTile tile)
|
||||
@@ -26,17 +26,13 @@ public class MisoCharacterSprite extends CharacterSprite
|
||||
return tile.isPassable();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the sprite's location on the x-axis in tile coordinates.
|
||||
*/
|
||||
// documentation inherited from interface
|
||||
public int getTileX ()
|
||||
{
|
||||
return _tilex;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the sprite's location on the y-axis in tile coordinates.
|
||||
*/
|
||||
// documentation inherited from interface
|
||||
public int getTileY ()
|
||||
{
|
||||
return _tiley;
|
||||
|
||||
Reference in New Issue
Block a user