|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--PlayField
Field Summary | |
Food[][] |
playfield
two-dimensional array of food; allows the microbes to have a fast access to the playfield |
int |
playfield_height
width and height of the playfield in units |
int |
playfield_width
width and height of the playfield in units |
static int |
TYPE_DEATH
additional drawmode: death |
static int |
TYPE_NEWLIFE
additional drawmode: new life |
static int |
TYPE_RANDOMFOOD
additional drawmode: random |
Constructor Summary | |
PlayField(int width,
int height,
int pixelsize)
creates the playfield with the parameters |
Method Summary | |
void |
clear_all()
fills the whole playfield with the food Food.TYPE_NOTHING |
void |
draw_all()
draws the whole playfield (without microbes!) |
void |
fill_all(int color)
fills the whole playfield with the food "color" and creates the playfield borders the playfield borders are hardcoded into the microbes brain to be unpassable |
void |
fill_random()
lets "rain" food in random order onto the playfield |
Microbe |
get_selectedmic()
returns the selected microbe |
int |
getfoodtype(int x,
int y)
returns the food type at the position (x,y) in the playfield |
void |
manualdraw(int x,
int y,
int type,
int size)
draws the food "type" with the brush size "size" onto the position (x,y) |
Microbe |
new_microbe(int x,
int y,
int start_energy,
int start_energyloss)
creates a new microbe |
void |
refresh()
calculates one step of every microbe and draws the changes |
void |
remove_microbe(int x,
int y)
removes the microbe at the position (x,y) on the playfield |
void |
set_graphics(Graphics g)
sets graphics context for all further graphic operations |
void |
setenergyloss(int new_energyloss)
sets the energyloss per stepp for every microbe |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
public static final int TYPE_RANDOMFOOD
public static final int TYPE_NEWLIFE
public static final int TYPE_DEATH
public int playfield_width
public int playfield_height
public Food[][] playfield
Constructor Detail |
public PlayField(int width, int height, int pixelsize)
width
- width of playfield in playfield-grid-pointsheight
- height of playfield in playfield-grid-pointspixelsize
- size of a pixel in the playfield (quadratic, unit: pixels)Method Detail |
public void set_graphics(Graphics g)
g
- graphics contextpublic void fill_all(int color)
color
- color (food-type) to fill the playfield withpublic void clear_all()
public void fill_random()
public void manualdraw(int x, int y, int type, int size)
x
- x positiony
- y positiontype
- food typesize
- size of the drawing brushpublic void setenergyloss(int new_energyloss)
new_ernergyloss
- new energyloss per step valuepublic int getfoodtype(int x, int y)
x
- x positiony
- y positionpublic void draw_all()
public void refresh()
public Microbe new_microbe(int x, int y, int start_energy, int start_energyloss)
x
- x positiony
- y positionstart_energy
- start energy for thge new microbestart_energyloss
- energy loss per steppublic void remove_microbe(int x, int y)
x
- x positiony
- y positionpublic Microbe get_selectedmic()
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |