Notify sprites when a new path is begun. Made time-based animation
work. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@445 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: Sprite.java,v 1.23 2001/09/17 23:55:45 shaper Exp $
|
||||
// $Id: Sprite.java,v 1.24 2001/10/12 00:36:03 shaper Exp $
|
||||
|
||||
package com.threerings.media.sprite;
|
||||
|
||||
@@ -327,6 +327,14 @@ public class Sprite
|
||||
_path = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called by the active path when it begins.
|
||||
*/
|
||||
protected void pathBeginning ()
|
||||
{
|
||||
// nothing for now
|
||||
}
|
||||
|
||||
/**
|
||||
* Called by the active path when it has completed.
|
||||
*/
|
||||
@@ -377,7 +385,6 @@ public class Sprite
|
||||
public void tick (long timestamp)
|
||||
{
|
||||
int fcount = _frames.getFrameCount();
|
||||
int nfidx = _frameIdx;
|
||||
boolean moved = false;
|
||||
|
||||
// move the sprite along toward its destination, if any
|
||||
@@ -386,13 +393,14 @@ public class Sprite
|
||||
}
|
||||
|
||||
// increment the display image if performing image animation
|
||||
int nfidx = _frameIdx;
|
||||
switch (_animMode) {
|
||||
case NO_ANIMATION:
|
||||
// nothing doing
|
||||
break;
|
||||
|
||||
case TIME_BASED:
|
||||
_frameIdx = (int)((timestamp/_frameDelay) % fcount);
|
||||
nfidx = (int)((timestamp/_frameDelay) % fcount);
|
||||
break;
|
||||
|
||||
case MOVEMENT_CUED:
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: LineSegmentPath.java,v 1.10 2001/09/17 23:55:45 shaper Exp $
|
||||
// $Id: LineSegmentPath.java,v 1.11 2001/10/12 00:36:03 shaper Exp $
|
||||
|
||||
package com.threerings.media.sprite;
|
||||
|
||||
@@ -111,6 +111,9 @@ public class LineSegmentPath implements Path
|
||||
// documentation inherited
|
||||
public void init (Sprite sprite, long timestamp)
|
||||
{
|
||||
// give the sprite a chance to perform any starting antics
|
||||
sprite.pathBeginning();
|
||||
|
||||
// if we have only one node then let the sprite know that we're
|
||||
// done straight away
|
||||
if (size() < 2) {
|
||||
|
||||
Reference in New Issue
Block a user