|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.farafin.snEADy.world.C_Arena
public final class C_Arena
Field Summary | |
---|---|
protected int[] |
freeFieldsVec
Field freeFieldsVec (for the Goodies) |
protected int |
freeFieldsVecLen
length of the Field freeFieldsVec |
private java.util.Vector |
gameObjects
Field gameObjects |
private int |
height
height of the playfield |
private int |
maxPlayer
the number of maximum player this level was designt for |
private java.lang.String |
name
name of the arena |
private char[][] |
playField
the playfield of the game |
private java.util.Random |
rnd
a random number |
private int |
width
width of the playfield |
Fields inherited from interface de.farafin.snEADy.communication.I_PlayFieldConstants |
---|
EXIT, FIELD_B, FIELD_C, FIELD_D, FIELD_E, FIELD_F, FIELD_G, FIELD_H, FIELD_I, FIELD_J, FIELD_K, FIELD_L, FIELD_M, FIELD_N, FIELD_O, FIELD_P, FIELD_Q, FIELD_R, FIELD_S, FIELD_T, FIELD_U, FIELD_V, FIELD_W, FIELD_X, FIELD_Y, FIELD_Z, FREE, GOODY_f, GOODY_g, GOODY_h, GOODY_i, GOODY_j, GOODY_k, GOODY_l, GOODY_LAST, GOODY_m, GOODY_n, GOODY_o, GOODY_p, GOODY_q, GOODY_r, GOODY_s, GOODY_START, GOODY_t, GOODY_u, GOODY_v, GOODY_w, GOODY_x, GOODY_y, GOODY_z, LENGTH, PLAYER_0, PLAYER_1, PLAYER_2, PLAYER_3, PLAYER_4, PLAYER_5, PLAYER_6, PLAYER_7, PLAYER_8, PLAYER_9, POINTS, SHORT, SLOW, SPEED, WALL |
Constructor Summary | |
---|---|
protected |
C_Arena(D_GameInfo gameInfo,
GameParameter parameter)
constructor |
protected |
C_Arena(java.lang.String name,
char[][] playField,
int maxPlayer)
constructor |
Method Summary | |
---|---|
private int |
fx(int j,
int k)
generates the funktion: k: (j) 1: (-1, 0, 1, 0) 2: (-2, -1, 0, 1, 2, 1, 0, -1) 3: (-3, -2, -1, 0, 1, 2, 3, 2, 1, 0, -1, -2) ... |
private int |
fy(int i,
int k)
generates the funktion: k: (i) 1: (0, 1, 0, -1) 2: (0, 1, 2, 1, 0, -1, -2, -1) 3: (0, 1, 2, 3, 2, 1, 0, -1, -2, -3, -2, -1) ... |
protected D_Level |
generateLevel()
|
protected char |
getCharOf(D_Vec2D vec)
returns the character of the specified coordinates |
protected char |
getCharOf(int y,
int x)
returns the character of the specified coordinates |
protected C_GameObject |
getGameObject(int number)
|
protected C_GameObject |
getGOofPos(D_Vec2D vec)
if at position of vec is placed a C_GameObject, it returns the Object. |
protected C_GameObject |
getGOofPos(int y,
int x)
if at position y,x is placed a C_GameObject, it returns the Object. |
protected int |
getHeight()
|
protected char[] |
getLineCopy(int l)
|
protected int |
getMaxPlayer()
|
protected java.lang.String |
getName()
|
protected int |
getNumberOfObjects()
|
protected char[][] |
getPlayFieldCopy()
|
protected char[] |
getRowCopy(int r)
height |
protected D_Vec2D[] |
getSourounding(D_Vec2D vec,
int maxDist)
returns all surrounding fields of vec in an array that is ordered that way: ___C___ __N4D__ _MB05E_ LA3#16F _K927G_ __J8H__ ___I___ the vectors in that positions are absolute positions in the arena. |
protected int |
getWidth()
|
protected boolean |
isFieldOfArena(D_Vec2D vec)
tests if the coordinates are element of the playField |
protected boolean |
isFieldOfArena(int y,
int x)
tests if the coordinates are element of the playField |
protected boolean |
isFree(char c)
|
protected boolean |
isFree(D_Vec2D vec)
|
protected boolean |
isFree(int y,
int x)
|
protected boolean |
isGoody(char c)
|
protected boolean |
isGoody(D_Vec2D vec)
|
protected boolean |
isGoody(int y,
int x)
|
protected boolean |
isSnake(char c)
|
protected boolean |
isSnake(D_Vec2D vec)
|
protected boolean |
isSnake(int y,
int x)
|
protected boolean |
isSpecialField(char c)
|
protected boolean |
isSpecialField(D_Vec2D vec)
|
protected boolean |
isSpecialField(int y,
int x)
|
protected boolean |
isWall(char c)
|
protected boolean |
isWall(D_Vec2D vec)
|
protected boolean |
isWall(int y,
int x)
|
protected void |
objectAdd(C_GameObject gameObj)
|
protected boolean |
objectDel(C_GameObject gameObj)
|
protected C_GameObject |
objectDel(int index)
|
protected void |
objectUpdate(C_GameObject gameObj)
update the status of the given gameObject. if the game Object likes to run, use this method to tell him to |
protected D_Vec2D |
randFreeField()
|
protected boolean |
setCharOnPosition(D_Vec2D vec,
char c)
sets at the coordiantes of vec the character c |
protected boolean |
setCharOnPosition(int y,
int x,
char c)
sets at the coordiantes y and x the character c |
protected boolean |
setFree(D_Vec2D vec)
sets at the coordiantes of vec a free field |
protected boolean |
setFree(int y,
int x)
sets at the coordiantes y and x a free field |
protected boolean |
setPlayField(char[][] field)
|
java.lang.String |
toString()
|
protected int |
updateFreeFieldVec(boolean ignoreGoodies)
returns the number of free fields in the playfield while storing its positions in a array |
protected boolean |
updateLevel(D_Level level)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private final java.lang.String name
private final int height
private final int width
private final char[][] playField
private final int maxPlayer
private final java.util.Vector gameObjects
protected final int[] freeFieldsVec
protected int freeFieldsVecLen
private final java.util.Random rnd
Constructor Detail |
---|
protected C_Arena(java.lang.String name, char[][] playField, int maxPlayer)
name
- playField
- uses array-data to compute height and widthmaxPlayer
- max player of this arenaprotected C_Arena(D_GameInfo gameInfo, GameParameter parameter)
gameInfo
- creates a C_Arena out of D_GameInfo.parameter
- the game parameter setMethod Detail |
---|
protected C_GameObject getGOofPos(int y, int x)
y
- y - coordinatex
- x - coordinate
protected C_GameObject getGOofPos(D_Vec2D vec)
vec
- the vector of the fied that should be controlled
public java.lang.String toString()
toString
in class java.lang.Object
protected boolean setPlayField(char[][] field)
field
- The playField to set.
protected boolean setCharOnPosition(int y, int x, char c)
y
and x
the character c
y
- linex
- rowc
- character to set
protected boolean setCharOnPosition(D_Vec2D vec, char c)
vec
the character c
vec
- coordinatec
- character to set
setCharOnPosition(int, int, char)
protected boolean setFree(int y, int x)
y
and x
a free field
y
- linex
- row
setCharOnPosition(int, int, char)
protected boolean setFree(D_Vec2D vec)
vec
a free field
vec
- coordinate
setCharOnPosition(int, int, char)
protected void objectAdd(C_GameObject gameObj)
gameObj
- protected boolean objectDel(C_GameObject gameObj)
gameObj
- the object that should be removed from the list
protected C_GameObject objectDel(int index)
index
- the index of the GameObject that should be rmoved
protected void objectUpdate(C_GameObject gameObj)
gameObj
- the object that should be updatedC_GameObject
protected C_GameObject getGameObject(int number)
number
- specifies the C_GameObject
C_GameObject
protected int getNumberOfObjects()
C_GameObject
protected boolean isFieldOfArena(int y, int x)
y
- linex
- row
protected boolean isFieldOfArena(D_Vec2D vec)
vec
- coordinate as 2D-vector
protected char[][] getPlayFieldCopy()
protected char getCharOf(int y, int x)
y
- line numberx
- row number
protected char getCharOf(D_Vec2D vec)
vec
- the vector of the field that should returned
protected char[] getLineCopy(int l)
l
- lineNumber
protected char[] getRowCopy(int r)
r
- rowNumber
protected int getHeight()
protected int getMaxPlayer()
protected java.lang.String getName()
protected int getWidth()
protected boolean isFree(char c)
c
- char to test
I_PlayFieldConstants
protected boolean isWall(char c)
c
- char to test
I_PlayFieldConstants
protected boolean isSnake(char c)
c
- char to test
I_PlayFieldConstants
protected boolean isGoody(char c)
c
- char to test
I_PlayFieldConstants
protected boolean isSpecialField(char c)
c
- char to test
I_PlayFieldConstants
protected boolean isFree(int y, int x)
y
- linex
- row
I_PlayFieldConstants
protected boolean isWall(int y, int x)
y
- linex
- row
I_PlayFieldConstants
protected boolean isSnake(int y, int x)
y
- linex
- row
I_PlayFieldConstants
protected boolean isGoody(int y, int x)
y
- linex
- row
I_PlayFieldConstants
protected boolean isSpecialField(int y, int x)
y
- linex
- row
I_PlayFieldConstants
protected boolean isFree(D_Vec2D vec)
vec
- controll this position
vec
positionI_PlayFieldConstants
protected boolean isWall(D_Vec2D vec)
vec
- controll this position
vec
positionI_PlayFieldConstants
protected boolean isSnake(D_Vec2D vec)
vec
- controll this position
vec
positionI_PlayFieldConstants
protected boolean isGoody(D_Vec2D vec)
vec
- controll this position
vec
positionI_PlayFieldConstants
protected boolean isSpecialField(D_Vec2D vec)
vec
- controll this position
vec
positionI_PlayFieldConstants
protected D_Level generateLevel()
protected boolean updateLevel(D_Level level)
level
- the lvel the local level should be stored in
private int fy(int i, int k)
i
- index in (...)k
- index of line
private int fx(int j, int k)
j
- index in (...)k
- index of line
protected D_Vec2D[] getSourounding(D_Vec2D vec, int maxDist)
vec
- the originmaxDist
- how many layer should be calculated
protected final int updateFreeFieldVec(boolean ignoreGoodies)
ignoreGoodies
-
protected final D_Vec2D randFreeField()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |