From 9df7d2d882a2ae8e71a9b2b36980af7dc8e1fc29 Mon Sep 17 00:00:00 2001 From: Walter Korman Date: Fri, 12 Oct 2001 00:41:48 +0000 Subject: [PATCH] Use time-based animation to animate the sprite while moving. Make sure the sprite comes to rest at a stand-still frame index. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@447 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- .../com/threerings/cast/CharacterSprite.java | 29 ++++++++++++++++--- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/src/java/com/threerings/cast/CharacterSprite.java b/src/java/com/threerings/cast/CharacterSprite.java index ecfe9b486..be7a11cc7 100644 --- a/src/java/com/threerings/cast/CharacterSprite.java +++ b/src/java/com/threerings/cast/CharacterSprite.java @@ -1,5 +1,5 @@ // -// $Id: CharacterSprite.java,v 1.10 2001/10/08 21:04:25 shaper Exp $ +// $Id: CharacterSprite.java,v 1.11 2001/10/12 00:41:48 shaper Exp $ package com.threerings.miso.scene; @@ -35,11 +35,9 @@ public class AmbulatorySprite extends Sprite implements Traverser // give ourselves an initial orientation setOrientation(DIR_NORTH); - - // we only animate when we're moving - setAnimationMode(MOVEMENT_CUED); } + // documentation inherited public void setOrientation (int orient) { super.setOrientation(orient); @@ -48,6 +46,29 @@ public class AmbulatorySprite extends Sprite implements Traverser setFrames(_anims[_orient]); } + // documentation inherited + protected void pathBeginning () + { + super.pathBeginning(); + + // enable walking animation + setAnimationMode(TIME_BASED); + } + + // documentation inherited + protected void pathCompleted () + { + super.pathCompleted(); + + // come to a halt looking settled and at peace + _frame = _frames.getFrame(_frameIdx = 0); + invalidate(); + + // disable walking animation + setAnimationMode(NO_ANIMATION); + } + + // documentation inherited public boolean canTraverse (MisoTile tile) { // by default, passability is solely the province of the tile