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;
|
package com.threerings.media.sprite;
|
||||||
|
|
||||||
@@ -327,6 +327,14 @@ public class Sprite
|
|||||||
_path = null;
|
_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.
|
* Called by the active path when it has completed.
|
||||||
*/
|
*/
|
||||||
@@ -377,7 +385,6 @@ public class Sprite
|
|||||||
public void tick (long timestamp)
|
public void tick (long timestamp)
|
||||||
{
|
{
|
||||||
int fcount = _frames.getFrameCount();
|
int fcount = _frames.getFrameCount();
|
||||||
int nfidx = _frameIdx;
|
|
||||||
boolean moved = false;
|
boolean moved = false;
|
||||||
|
|
||||||
// move the sprite along toward its destination, if any
|
// move the sprite along toward its destination, if any
|
||||||
@@ -386,13 +393,14 @@ public class Sprite
|
|||||||
}
|
}
|
||||||
|
|
||||||
// increment the display image if performing image animation
|
// increment the display image if performing image animation
|
||||||
|
int nfidx = _frameIdx;
|
||||||
switch (_animMode) {
|
switch (_animMode) {
|
||||||
case NO_ANIMATION:
|
case NO_ANIMATION:
|
||||||
// nothing doing
|
// nothing doing
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TIME_BASED:
|
case TIME_BASED:
|
||||||
_frameIdx = (int)((timestamp/_frameDelay) % fcount);
|
nfidx = (int)((timestamp/_frameDelay) % fcount);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MOVEMENT_CUED:
|
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;
|
package com.threerings.media.sprite;
|
||||||
|
|
||||||
@@ -111,6 +111,9 @@ public class LineSegmentPath implements Path
|
|||||||
// documentation inherited
|
// documentation inherited
|
||||||
public void init (Sprite sprite, long timestamp)
|
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
|
// if we have only one node then let the sprite know that we're
|
||||||
// done straight away
|
// done straight away
|
||||||
if (size() < 2) {
|
if (size() < 2) {
|
||||||
|
|||||||
Reference in New Issue
Block a user