uwcse.sim
Class Firework

java.lang.Object
  |
  +--uwcse.sim.AbstractParticle
        |
        +--uwcse.sim.Firework
All Implemented Interfaces:
Thing
Direct Known Subclasses:
ExplodingFirework, StarFirework, TracerSpot

class Firework
extends AbstractParticle

A firework is a simple glowing particle of random color. It is subject to the law of gravity, so its velocity in the Y direction increases every turn.


Field Summary
protected  java.awt.Color color
           
(package private) static java.awt.Color[] colors
           
protected  int radius
           
 
Fields inherited from class uwcse.sim.AbstractParticle
age, rand, velX, velY, world, x, y
 
Constructor Summary
Firework(WorldModel wm, int x, int y, int velX, int velY)
          Create a new firework of random color.
 
Method Summary
 void action()
          So super.action(), and increase the Y velocity.
 void displayOn(uwcse.graphics.GWindow g)
          Display as a circle.
 
Methods inherited from class uwcse.sim.AbstractParticle
getX, getY, isAlive, toString
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

radius

protected int radius

color

protected java.awt.Color color

colors

static java.awt.Color[] colors
Constructor Detail

Firework

public Firework(WorldModel wm,
                int x,
                int y,
                int velX,
                int velY)
Create a new firework of random color.
Method Detail

displayOn

public void displayOn(uwcse.graphics.GWindow g)
Display as a circle.
Overrides:
displayOn in class AbstractParticle

action

public void action()
So super.action(), and increase the Y velocity.
Overrides:
action in class AbstractParticle