public class CharacterSprite extends ImageSprite implements StandardActions
DEFAULT_FRAME_RATE, MOVEMENT_CUED, NO_ANIMATION, TIME_BASED, TIME_SEQUENTIALHUD_LAYERCROP_TYPE, SHADOW_TYPE, STANDING, WALKINGCARDINAL_DIRECTIONS, CCW, CW, DIRECTION_COUNT, DOWN, EAST, EASTNORTHEAST, EASTSOUTHEAST, FINE_DIRECTION_COUNT, HORIZONTAL, LEFT, NONE, NORTH, NORTHEAST, NORTHNORTHEAST, NORTHNORTHWEST, NORTHWEST, RIGHT, SOUTH, SOUTHEAST, SOUTHSOUTHEAST, SOUTHSOUTHWEST, SOUTHWEST, UP, VERTICAL, WEST, WESTNORTHWEST, WESTSOUTHWEST| Constructor and Description |
|---|
CharacterSprite() |
| Modifier and Type | Method and Description |
|---|---|
void |
cancelMove()
Cancels any path that the sprite may currently be moving along.
|
String |
getFollowingPathAction()
Returns the action to be used when the sprite is following a path.
|
String |
getRestingAction()
Returns the action to be used when the sprite is at rest.
|
boolean |
hitTest(int x,
int y)
Returns true if the sprite's bounds contain the specified point, and if there is a
non-transparent pixel in the sprite's image at the specified point, false if not.
|
void |
init(CharacterDescriptor descrip,
CharacterManager charmgr)
Initializes this character sprite with the specified character descriptor and character
manager.
|
void |
paint(Graphics2D gfx)
Called by the appropriate manager to request that the media render itself with the given
graphics context.
|
void |
pathBeginning()
Called by the active path when it begins.
|
void |
pathCompleted(long timestamp)
Called by the active path when it has completed.
|
void |
setActionSequence(String action)
Sets the action sequence used when rendering the character, from the set of available
sequences.
|
void |
setCharacterDescriptor(CharacterDescriptor descrip)
Reconfigures this sprite to use the specified character descriptor.
|
void |
setFollowingPathAction(String action)
Specifies the action to use when the sprite is following a path.
|
void |
setOrientation(int orient)
Sprites have an orientation in one of the eight cardinal directions:
DirectionCodes.NORTH, DirectionCodes.NORTHEAST, etc. |
void |
setRestingAction(String action)
Specifies the action to use when the sprite is at rest.
|
void |
tick(long tickStamp)
Called periodically by this media's manager to give it a chance to do its thing.
|
layout, setAnimationMode, setFrameRate, setFrames, setMirageaddSpriteObserver, contains, fastForward, getHeight, getOrientation, getPath, getWidth, getX, getXOffset, getY, getYOffset, inside, intersects, isMoving, move, paintPath, removeSpriteObserver, setLocation, viewLocationDidChangecontains, contains, contains, contains, getBounds, getBounds2D, getPathIterator, getPathIterator, getRenderOrder, init, intersects, intersects, invalidate, queueNotification, renderCompareTo, setRenderOrder, toStringpublic void init(CharacterDescriptor descrip, CharacterManager charmgr)
public void setCharacterDescriptor(CharacterDescriptor descrip)
public void setRestingAction(String action)
STANDING.public String getRestingAction()
public void setFollowingPathAction(String action)
WALKING.public String getFollowingPathAction()
public void setActionSequence(String action)
public void setOrientation(int orient)
SpriteDirectionCodes.NORTH, DirectionCodes.NORTHEAST, etc. Derived classes can
choose to override this member function and select a different set of images based on their
orientation, or they can ignore the orientation information.setOrientation in interface PathablesetOrientation in class SpriteDirectionCodespublic boolean hitTest(int x,
int y)
ImageSpritehitTest in class ImageSpritepublic void tick(long tickStamp)
AbstractMediatick in class ImageSpritetickStamp - a time stamp associated with this tick. Note: this is not obtained
from a call to System.currentTimeMillis() and cannot be compared to timestamps
obtained there from.public void cancelMove()
SpritecancelMove in class Spritepublic void pathBeginning()
SpritepathBeginning in interface PathablepathBeginning in class Spritepublic void pathCompleted(long timestamp)
SpritepathCompleted in interface PathablepathCompleted in class Spritepublic void paint(Graphics2D gfx)
AbstractMediapaint in class ImageSpriteCopyright © 2015. All rights reserved.