sprite
Class OvalSprite

java.lang.Object
  extended by sprite.Sprite
      extended by sprite.OvalSprite

public class OvalSprite
extends Sprite

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

OvalSprite

public OvalSprite(int w,
                  int h)
Creates a black oval.

Parameters:
w - the width of the oval.
h - the height of the oval.

OvalSprite

public OvalSprite(int w,
                  int h,
                  java.awt.Color c)
Creates a colored oval.

Parameters:
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

draw

public void draw(java.awt.Graphics g)
Description copied from class: Sprite
This method is called by the SpritePanel to tell the sprite to draw itself. It is not meant to be called directly. Subclasses should override this method to draw an appropriate picture. The method in this class just draws a tiny black dot at the location of the sprite.

Overrides:
draw in class Sprite

getColor

public java.awt.Color getColor()

setColor

public void setColor(java.awt.Color c)
Sets the color of the sprite. If the color is null, then the default color, black, is used.