|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.ObjectParticle
public class Particle
A Particle is a 2D colored dot that follows basic physics. It has a velocity and is affected by gravity. It is able to move itself and to draw itself.
| Field Summary | |
|---|---|
static double |
GRAVITY
The acceleration (in pixels per frame) due to "Gravity" |
| Constructor Summary | |
|---|---|
Particle(double hue,
double angle,
double speed,
double startX,
double startY)
Creates a new Particle based on the given parameters. |
|
| Method Summary | |
|---|---|
void |
drawSelf(java.awt.Graphics graphics)
Draw this Particle onto the provided Graphics object |
int |
getTimesMoved()
Return the number of times this Particle has been moved. |
double |
getXPosition()
Return the X position of this Particle |
double |
getYPosition()
Return the Y position of this Particle |
void |
takeOneStep()
Move this Particle one frame's worth of movement |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final double GRAVITY
| Constructor Detail |
|---|
public Particle(double hue,
double angle,
double speed,
double startX,
double startY)
hue - A number from 0 to 1 that specifies desired hue of the
Particleangle - The desired angle in degressspeed - The desired speed in pixels per framestartX - The starting x coordinatestartY - The starting y coordinate| Method Detail |
|---|
public void drawSelf(java.awt.Graphics graphics)
graphics - The Graphics object to draw onto.public void takeOneStep()
public double getXPosition()
public double getYPosition()
public int getTimesMoved()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||