|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectexample.wormgame.WormFood
public class WormFood
WormFood is a food item that the worm can eat. It is placed at a pseudo randomly generated location in the pit.
Constructor Summary | |
---|---|
WormFood(WormPit pit)
Constructor for worm food object. |
Method Summary | |
---|---|
int |
getX()
Get the X coordinate of the cell that contains the food item. |
int |
getY()
Get the Y coordinate of the cell that contains the food item. |
boolean |
isAt(int cx,
int cy)
Returns true if the food item is at the given cell. |
void |
paint(javax.microedition.lcdui.Graphics g)
Paint the piece of food. |
void |
regenerate()
Regenerate the food item. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public WormFood(WormPit pit)
pit
- pit to which the food is associated. (unused currently)Method Detail |
---|
public boolean isAt(int cx, int cy)
cx
- x coordinate of cell to testcy
- y coordinate of cell to test
public int getX()
public int getY()
public void regenerate()
public void paint(javax.microedition.lcdui.Graphics g)
g
- graphics object to receive rendering of food object
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |