|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object wyvern.lib.properties.AnimationParams
Handles object animation.
Field Summary | |
static int |
DEFAULT_FRAMES
The default number of frames for animated objects is 2. |
static int |
DEFAULT_INTERVAL
The default time between frames is a second or so. |
static int |
SMALLEST_INTERVAL
The smallest allowable animation interval. |
Constructor Summary | |
AnimationParams()
Constructs a new AnimationParams with the default parameters. |
|
AnimationParams(int frames)
Constructs a new AnimationParams with the specified number of frames, using the default animation interval. |
|
AnimationParams(int frames,
int interval)
Constructs a new AnimationParams with the specified parameters. |
Method Summary | |
java.lang.Object |
createClone()
Produces a clone of the property for the caller. |
void |
destroy()
Destroys the AnimationParams, cleaning up any object references, so we don't get memory leaks. |
boolean |
equals(java.lang.Object other)
Returns true if two AnimationParams are equivalent. |
int |
getFrames()
Returns the number of animation frames for this object. |
int |
getInterval()
Returns the animation speed for this object. |
int |
hashCode()
Have to override this if you override equals() |
void |
mapLoaded(MapLifecycleEvent e)
Invoked when a map is loaded. |
void |
mapResumed(MapLifecycleEvent e)
Restarts animation when map is resumed. |
void |
mapSuspended(MapLifecycleEvent e)
Stops animation when map is suspended. |
void |
mapUnloaded(MapLifecycleEvent e)
Stops animation when map is unloaded. |
void |
setFrames(int frames)
Sets the number of frames in this animation. |
void |
setInterval(int interval)
Sets the delay between animation frames for this object. |
void |
start(GameObject obj)
Starts the animation timer for our object. |
void |
stop()
Stops the animation timer for our target. |
void |
targetEnteredMap(MapChangeEvent event)
Notification that our target entered a map. |
void |
targetLeftMap(MapChangeEvent event)
Notification that our target left a map. |
void |
timerExpired()
Called by TimerManager to notify object that timer has expired. |
java.lang.String |
toString()
Returns a String representation of this object. |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int DEFAULT_FRAMES
public static final int DEFAULT_INTERVAL
public static final int SMALLEST_INTERVAL
Constructor Detail |
public AnimationParams()
public AnimationParams(int frames)
public AnimationParams(int frames, int interval)
frames
- the total number of animation frames, including
the "base" frame.interval
- the time between frames, in millisecondsMethod Detail |
public int getFrames()
public void setFrames(int frames)
frames
- the total number of frames to cycle throughpublic int getInterval()
public void setInterval(int interval)
interval
- the delay between framespublic void start(GameObject obj)
obj
- the object to animate. It's passed in by setAnimated()
in class GameObject. You probably shouldn't call this method
directly, but should call GameObject.setAnimated instead. public void stop()
If the target is going away permanently, you should call destroy(). Calling MapObject.destroy() takes care of this, if the AnimationParams object is in the target's property list under the name "anima". However, if you're managing the AnimationParams yourself, or you can't call destroy() on your object, you need to call destroy() explicitly, or you'll wind up with a memory leak.
public void timerExpired()
timerExpired
in interface Timed
public void targetEnteredMap(MapChangeEvent event)
targetEnteredMap
in interface MapChangeListener
public void targetLeftMap(MapChangeEvent event)
targetLeftMap
in interface MapChangeListener
public void mapSuspended(MapLifecycleEvent e)
mapSuspended
in interface MapLifecycleListener
public void mapUnloaded(MapLifecycleEvent e)
mapUnloaded
in interface MapLifecycleListener
public void mapResumed(MapLifecycleEvent e)
mapResumed
in interface MapLifecycleListener
public void mapLoaded(MapLifecycleEvent e)
MapLifecycleListener
mapLoaded
in interface MapLifecycleListener
public java.lang.String toString()
public java.lang.Object createClone()
createClone
in interface MutableProperty
public boolean equals(java.lang.Object other)
public int hashCode()
public void destroy()
If the target is going away permanently, you should call destroy(). Calling MapObject.destroy() takes care of this, if the AnimationParams object is in the target's property list under the name "anima". However, if you're managing the AnimationParams yourself, or you can't call destroy() on your object, you need to call destroy() explicitly, or you'll wind up with a memory leak.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |