public class Character extends DirectionAnimatedSprite
Sprite.BoundaryPolicy
Modifier and Type | Field and Description |
---|---|
protected int |
speed
The speed the character moves with.
|
protected java.awt.Point |
target
Position where the character should move to.
|
currentDirection, movementAnimations, noMovementAnimations
animatedImage, invisibleAfterFrames
Constructor and Description |
---|
Character(Board board,
java.awt.Point startPoint,
int speed,
Sprite.BoundaryPolicy policy,
AnimatedImage noDirection,
AnimatedImage west,
AnimatedImage east,
AnimatedImage north,
AnimatedImage south,
AnimatedImage noMovementWest,
AnimatedImage noMovementEast,
AnimatedImage noMovementNorth,
AnimatedImage noMovementSouth)
Create a new sprite.
|
Modifier and Type | Method and Description |
---|---|
void |
move()
Move the sprite according to the defined speed.
|
void |
setTarget(java.awt.Point target)
Sets the target position of the character.
|
draw, setAllMovementAnimations, setAllNoMovementAnimations, setMovementAnimation, setNoMovementAnimation
setImages, setInvisibleAfterFrames
absoluteBorder, draw, ensureBoundaryPolicy, getDimension, getHeight, getPosition, getVelocity, getWidth, intersects, intersects, intersects, intersects, intersects, isActive, isVisible, keyPressed, keyReleased, keyTyped, loadPolygonFromFile, mouseClicked, mouseClicked, mouseEntered, mouseExited, mousePressed, mousePressed, mouseReleased, move, setActive, setBorder, setBounds, setPosition, setVelocity, setVisible, stop
protected int speed
protected java.awt.Point target
public Character(Board board, java.awt.Point startPoint, int speed, Sprite.BoundaryPolicy policy, AnimatedImage noDirection, AnimatedImage west, AnimatedImage east, AnimatedImage north, AnimatedImage south, AnimatedImage noMovementWest, AnimatedImage noMovementEast, AnimatedImage noMovementNorth, AnimatedImage noMovementSouth)
board
- our boardstartPoint
- start positionspeed
- the speed of the objectpolicy
- policy used when sprite reachesnoDirection
- animation for no directionwest
- animation for movement to the westeast
- animation for movement to the eastnorth
- animation for movement northsouth
- animation for movement southnoMovementWest
- animation for non-moving sprite, facing to the westnoMovementEast
- animation for non-moving sprite, facing to the eastnoMovementNorth
- animation for non-moving sprite, facing to the northnoMovementSouth
- animation for non-moving sprite, facing to the south