public abstract class AnimatedSprite extends Sprite
Sprite.BoundaryPolicy
Modifier and Type | Field and Description |
---|---|
protected AnimatedImage |
animatedImage
the image that is displayed.
|
protected int |
invisibleAfterFrames
Hide the sprite after the given number of frames.
|
Constructor and Description |
---|
AnimatedSprite(Board board,
java.awt.Point startPoint,
AnimatedImage animatedImage)
Create a new sprite.
|
AnimatedSprite(Board board,
java.awt.Point startPoint,
Sprite.BoundaryPolicy policy,
AnimatedImage animatedImage)
Create a new sprite.
|
Modifier and Type | Method and Description |
---|---|
void |
draw(java.awt.Graphics g,
java.awt.image.ImageObserver observer)
Draw the sprite.
|
void |
setImages(AnimatedImage newImages)
Set the animated image.
|
void |
setInvisibleAfterFrames(int invisibleAfterFrames)
Sets the number of frames the sprite is invisible after.
|
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, move, setActive, setBorder, setBounds, setPosition, setVelocity, setVisible, stop
protected AnimatedImage animatedImage
protected int invisibleAfterFrames
public AnimatedSprite(Board board, java.awt.Point startPoint, AnimatedImage animatedImage)
board
- our boardstartPoint
- start point of the spriteanimatedImage
- the animatedImagepublic AnimatedSprite(Board board, java.awt.Point startPoint, Sprite.BoundaryPolicy policy, AnimatedImage animatedImage)
board
- our boardstartPoint
- start point of the spritepolicy
- the boundary policy for this spriteanimatedImage
- the animatedImagepublic void draw(java.awt.Graphics g, java.awt.image.ImageObserver observer)
Sprite
draw
in class Sprite
g
- graphics contextobserver
- image observerSprite.draw(Graphics, ImageObserver)
public void setImages(AnimatedImage newImages)
newImages
- the new animatedImagepublic void setInvisibleAfterFrames(int invisibleAfterFrames)
invisibleAfterFrames
- number of frames