Register the character sprite appropriately so we can be hit-test against on mouseover.
git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@958 c613c5cb-e716-0410-b11b-feb51c14d237
This commit is contained in:
@@ -27,15 +27,17 @@ import com.threerings.util.DirectionCodes;
|
|||||||
import com.threerings.media.Tickable;
|
import com.threerings.media.Tickable;
|
||||||
import com.threerings.media.util.Path;
|
import com.threerings.media.util.Path;
|
||||||
import com.threerings.media.util.Pathable;
|
import com.threerings.media.util.Pathable;
|
||||||
|
import com.threerings.miso.client.PriorityIsoDisplayObject;
|
||||||
import com.threerings.miso.util.MisoSceneMetrics;
|
import com.threerings.miso.util.MisoSceneMetrics;
|
||||||
import com.threerings.miso.util.MisoUtil;
|
import com.threerings.miso.util.MisoUtil;
|
||||||
import com.threerings.stage.data.StageLocation;
|
import com.threerings.stage.data.StageLocation;
|
||||||
|
|
||||||
import as3isolib.display.IsoSprite;
|
import as3isolib.display.IsoSprite;
|
||||||
|
import as3isolib.display.scene.IsoScene;
|
||||||
import as3isolib.graphics.SolidColorFill;
|
import as3isolib.graphics.SolidColorFill;
|
||||||
|
|
||||||
public class CharacterIsoSprite extends IsoSprite
|
public class CharacterIsoSprite extends IsoSprite
|
||||||
implements Pathable
|
implements Pathable, PriorityIsoDisplayObject
|
||||||
{
|
{
|
||||||
public function CharacterIsoSprite (bodyOid :int, metrics :MisoSceneMetrics,
|
public function CharacterIsoSprite (bodyOid :int, metrics :MisoSceneMetrics,
|
||||||
charSprite :CharacterSprite)
|
charSprite :CharacterSprite)
|
||||||
@@ -55,6 +57,8 @@ public class CharacterIsoSprite extends IsoSprite
|
|||||||
_character = charSprite;
|
_character = charSprite;
|
||||||
|
|
||||||
sprites = [wrapper];
|
sprites = [wrapper];
|
||||||
|
|
||||||
|
autoUpdate = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function tick (tickStamp :int) :void
|
public function tick (tickStamp :int) :void
|
||||||
@@ -64,7 +68,9 @@ public class CharacterIsoSprite extends IsoSprite
|
|||||||
_pathStamp = tickStamp
|
_pathStamp = tickStamp
|
||||||
_path.init(this, _pathStamp);
|
_path.init(this, _pathStamp);
|
||||||
}
|
}
|
||||||
_path.tick(this, tickStamp);
|
if (_path != null) {
|
||||||
|
_path.tick(this, tickStamp);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
_character.tick(tickStamp);
|
_character.tick(tickStamp);
|
||||||
}
|
}
|
||||||
@@ -98,13 +104,11 @@ public class CharacterIsoSprite extends IsoSprite
|
|||||||
public function setLocation (x :Number, y :Number) :void
|
public function setLocation (x :Number, y :Number) :void
|
||||||
{
|
{
|
||||||
moveTo(x, y, 0);
|
moveTo(x, y, 0);
|
||||||
render();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setOrientation (orient :int) :void
|
public function setOrientation (orient :int) :void
|
||||||
{
|
{
|
||||||
_character.setOrientation(toIsoOrient(orient));
|
_character.setOrientation(toIsoOrient(orient));
|
||||||
render();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function toIsoOrient (orient :int) :int
|
public function toIsoOrient (orient :int) :int
|
||||||
@@ -172,6 +176,16 @@ public class CharacterIsoSprite extends IsoSprite
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getPriority () :int
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function hitTest (stageX :int, stageY :int) :Boolean
|
||||||
|
{
|
||||||
|
return _character == null ? false : _character.hitTest(stageX, stageY);
|
||||||
|
}
|
||||||
|
|
||||||
protected var _bodyOid :int;
|
protected var _bodyOid :int;
|
||||||
|
|
||||||
protected var _metrics :MisoSceneMetrics;
|
protected var _metrics :MisoSceneMetrics;
|
||||||
|
|||||||
Reference in New Issue
Block a user