|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectPellets
public class Pellets
Pellets, to be eaten by Caterpillars in the Munch Game.
MunchGame
Constructor Summary | |
---|---|
Pellets(java.awt.Color c,
int num)
Create the new pellets, with the given color at randomly chosen positions. |
Method Summary | |
---|---|
boolean |
allGone()
Determine whether all of the pellets have been consumed. |
boolean |
onPosition(java.awt.Point p)
Determine whether a pellet lies on the given position. |
void |
paint(java.awt.Graphics g)
Draw the pellets on the given pane |
void |
remove(java.awt.Point p)
Remove the pellet at Point p from the collection of pellets. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Pellets(java.awt.Color c, int num)
c
- the pellet colornum
- the number of pelletsMethod Detail |
---|
public boolean onPosition(java.awt.Point p)
p
- the position to test
true
if a pellet lies on p; false
otherwisepublic void remove(java.awt.Point p)
p
- the Point that has the pellet to removepublic boolean allGone()
true
if there are no more pellets; false
otherwisepublic void paint(java.awt.Graphics g)
g
- the Graphics pane on which to draw the pellet
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |