|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavoids.BasicSprite
javoids.Sprite
public abstract class Sprite
A sprite class to have a moving game object.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class javoids.BasicSprite |
---|
BasicSprite.Collision, BasicSprite.Gravity |
Field Summary | |
---|---|
private java.util.Vector<java.awt.geom.Area> |
areas
the areas representing this sprite's shape |
private java.util.Vector<java.awt.Color> |
colors
the colors that correspond to a sprite's areas |
private ImageMap.Name |
imageNumber
the image name representing the sprite |
private double |
initialX
the initial x coordinate |
private double |
initialY
the initial y coordinate |
private ImageMap.Name |
originalImageNumber
the original image name |
private static long |
serialVersionUID
This is the version used for serializing/deserializing (storing/retrieving) this object |
private Shapes.Shape |
shape
the sprite's shape |
private Shield |
shield
the shield protecting the sprite |
Fields inherited from class javoids.BasicSprite |
---|
size |
Constructor Summary | |
---|---|
Sprite(BasicSprite parent,
Health health,
Move move,
int _size,
ImageMap.Name _imageNumber,
java.util.Vector<java.awt.geom.Area> _areas,
java.util.Vector<java.awt.Color> _colors)
Constructor |
Method Summary | |
---|---|
void |
draw(java.awt.Graphics2D g2d,
java.awt.Graphics2D foregroundImage)
Draw the shapes or images onto the foreground image (for double buffering). |
private void |
drawImage(java.awt.Graphics2D g2d,
java.awt.Graphics2D foregroundImage)
Draw an image on the screen. |
private void |
drawShape(java.awt.Graphics2D g2d,
java.awt.Graphics2D foregroundImage,
java.awt.geom.Area area)
Draw a single area on the screen. |
private void |
drawShapes(java.awt.Graphics2D g2d,
java.awt.Graphics2D foregroundImage)
Draw all of a sprite's shapes on the screen |
java.util.Vector<java.awt.geom.Area> |
getAreas()
|
java.util.Vector<java.awt.Color> |
getColors()
|
abstract ImageMap.Name |
getImageNumber()
|
double |
getMultiplier()
|
ImageMap.Name |
getOriginalImage()
|
Shapes.Shape |
getShape()
|
private void |
setAreas()
Set the areas that represent the sprite's shape. |
void |
setAreas(java.util.Vector<java.awt.geom.Area> _areas)
|
protected void |
setColors()
Set the colors that go with the sprit'es areas. |
void |
setColors(java.util.Vector<java.awt.Color> _colors)
|
void |
setImage(ImageMap.Name _imageNumber)
|
void |
setShape(Shapes.Shape _shape)
|
void |
setSize(int _size)
set the sprite's size |
java.lang.String |
toString()
Provide a String representation of this object. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface javoids.Sizes |
---|
getDefaultSize, getMaximumSize, getMinimumSize |
Field Detail |
---|
private static final long serialVersionUID
private Shield shield
private ImageMap.Name imageNumber
private ImageMap.Name originalImageNumber
private Shapes.Shape shape
private double initialX
private double initialY
private java.util.Vector<java.awt.geom.Area> areas
private java.util.Vector<java.awt.Color> colors
Constructor Detail |
---|
public Sprite(BasicSprite parent, Health health, Move move, int _size, ImageMap.Name _imageNumber, java.util.Vector<java.awt.geom.Area> _areas, java.util.Vector<java.awt.Color> _colors)
parent
- the parent of this spritehealth
- the health informationmove
- the movment information_size
- the size this should be_imageNumber
- the image numbeer to use for this sprite_areas
- the areas used to represent or draw the sprite (needed even if using an image for area collision detection)_colors
- the colors of each area (in the same order as the areas)Method Detail |
---|
public java.util.Vector<java.awt.Color> getColors()
getColors
in class BasicSprite
public Shapes.Shape getShape()
public void setShape(Shapes.Shape _shape)
_shape
- set the shape name for this spritepublic java.util.Vector<java.awt.geom.Area> getAreas()
getAreas
in class BasicSprite
public void setAreas(java.util.Vector<java.awt.geom.Area> _areas)
_areas
- the areas that represent the shape of this spriteprivate void setAreas()
public void setColors(java.util.Vector<java.awt.Color> _colors)
_colors
- the colors that correspond to the areas of this spriteprotected void setColors()
public void setSize(int _size)
BasicSprite
setSize
in class BasicSprite
_size
- the size of the spritepublic void draw(java.awt.Graphics2D g2d, java.awt.Graphics2D foregroundImage)
draw
in class BasicSprite
g2d
- the graphics context used to draw this spriteforegroundImage
- the image use to draw this sprite onprivate void drawImage(java.awt.Graphics2D g2d, java.awt.Graphics2D foregroundImage)
g2d
- the graphics context used to draw this spriteforegroundImage
- the image use to draw this sprite onprivate void drawShape(java.awt.Graphics2D g2d, java.awt.Graphics2D foregroundImage, java.awt.geom.Area area)
g2d
- the graphics context used to draw this spriteforegroundImage
- the image use to draw this sprite onarea
- the are to drawprivate void drawShapes(java.awt.Graphics2D g2d, java.awt.Graphics2D foregroundImage)
g2d
- the graphics context used to draw this spriteforegroundImage
- the image use to draw this sprite onpublic abstract ImageMap.Name getImageNumber()
public ImageMap.Name getOriginalImage()
public double getMultiplier()
getMultiplier
in class BasicSprite
public void setImage(ImageMap.Name _imageNumber)
_imageNumber
- set the image name for this spritepublic java.lang.String toString()
toString
in class BasicSprite
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |