java.lang.Objectsprite.Sprite
sprite.OvalSprite
public class OvalSprite
A simple sprite which is filled, colored oval whose width and height are equal to the width and height of the sprite. The position of the sprite is the center of the oval.
Field Summary |
---|
Fields inherited from class sprite.Sprite |
---|
EXIT_POLICY_BOUNCE, EXIT_POLICY_DIE, EXIT_POLICY_STOP, EXIT_POLICY_WRAP |
Constructor Summary | |
---|---|
OvalSprite(int w,
int h)
Creates a black oval. |
|
OvalSprite(int w,
int h,
java.awt.Color c)
Creates a colored oval. |
Method Summary | |
---|---|
void |
draw(java.awt.Graphics g)
This method is called by the SpritePanel to tell the sprite to draw itself. |
java.awt.Color |
getColor()
|
void |
setColor(java.awt.Color c)
Sets the color of the sprite. |
Methods inherited from class sprite.Sprite |
---|
contains, die, getDx, getDy, getExitPolicy, getHome, getSpriteHeight, getSpriteWidth, getX, getY, isDead, isImmuneToBullets, onDeath, prepareForNextFrame, randomVelocity, setDx, setDy, setExitPolicy, setImmuneToBullets, setLocation, setSpriteHeight, setSpriteWidth, setUseOvalForContains, setVelocity, setX, setY |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public OvalSprite(int w, int h)
w
- the width of the oval.h
- the height of the oval.public OvalSprite(int w, int h, java.awt.Color c)
w
- the width of the oval.h
- the height of the oval.color
- the color of the sprite. If this is null, then the sprite is black.Method Detail |
---|
public void draw(java.awt.Graphics g)
Sprite
draw
in class Sprite
public java.awt.Color getColor()
public void setColor(java.awt.Color c)