|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Object
|
+--SpaceInvaders.Point
|
+--SpaceInvaders.Pixel
|
+--SpaceInvaders.Star
Encapsulates star behavior.
| Field Summary | |
private Point |
prevPos
previous screen position |
| Fields inherited from class SpaceInvaders.Pixel |
c |
| Fields inherited from class SpaceInvaders.Point |
x, y |
| Constructor Summary | |
Star(Point p,
java.awt.Color c)
Accepts a star's screen position and color. |
|
| Method Summary | |
void |
draw(java.awt.Graphics g)
Draws the star on the screen. |
int |
getX()
Gets x coordinate. |
int |
getY()
Gets y coordinate. |
void |
move()
Advances star straight downward 1 pixel per move, restarting the screen position to the top of the screen when the star moves off the bottom of the screen. |
| Methods inherited from class SpaceInvaders.Pixel |
getColor, setColor |
| Methods inherited from class SpaceInvaders.Point |
setX, setXY, setY |
| Methods inherited from class java.lang.Object |
|
| Field Detail |
private Point prevPos
| Constructor Detail |
public Star(Point p,
java.awt.Color c)
p - screen positionc - the RGB color| Method Detail |
public int getX()
getX in class Pointpublic int getY()
getY in class Pointpublic void draw(java.awt.Graphics g)
g - Graphics context to draw in.public void move()
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||