|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.farafin.snEADy.world.C_GameObject
public abstract class C_GameObject
all objects in the world should extend fromthis class. this is the representation of the Objects on the playfield. so to say their body.
Field Summary | |
---|---|
protected int |
faceDirection
the direction the Object faces to |
protected D_Vec2D |
headPosition
the position of the head. even if the object is larger than one field, it needs a position |
protected long |
nextUpdateTime
when is the object updated next time? |
protected RingVector |
objPositions
all positions of the object, inlcuding the head! |
protected char |
ownChar
the own representation on the playField |
protected GameParameter |
parameter
parameter set of GameParameter |
protected long |
waitCycles
the freuency with what the gaObject should be updated. |
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_m, GOODY_n, GOODY_o, GOODY_p, GOODY_q, GOODY_r, GOODY_s, 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_GameObject()
default constructor |
protected |
C_GameObject(C_GameObject obj)
copy constructor reference-copy of attrbutes: use copy() if you need a full copy |
protected |
C_GameObject(D_Vec2D headPosition,
int faceDirection,
char ownChar,
long waitCycles,
GameParameter parameter)
constructor |
protected |
C_GameObject(D_Vec2D headPosition,
int faceDirection,
RingVector objPositions,
char ownChar,
long waitCycles,
GameParameter parameter)
create constructor |
protected |
C_GameObject(GameParameter parameter)
default constructor |
Method Summary | |
---|---|
protected abstract java.lang.Object |
clone()
|
protected D_Vec2D[] |
getAllPosArray()
|
protected java.util.LinkedList |
getAllPosList()
|
protected abstract D_Vec2D[] |
getAllPosSorted(int sort)
|
protected int |
getFaceDirection()
|
protected D_Vec2D |
getHeadPosition()
|
protected D_Vec2D |
getNextPosInFaceDirection(C_Arena arena)
returns the next position if the object would move one fieled in its face direction. |
protected long |
getNextUpdateTime()
|
protected char |
getOwnChar()
|
protected void |
jumpHeadPos(D_Vec2D dest)
Moves only the head and the zero-element of the position-list to the new position |
protected abstract void |
jumpTo(D_Vec2D pos,
C_Arena arena)
moves the object with all its positions to the specific position. |
protected void |
setFaceDirection(int faceDirection)
|
protected void |
setHeadPosition(D_Vec2D headPosition)
|
abstract java.lang.String |
toString()
|
protected abstract void |
update(C_Arena arena)
the update call meens that the object should do what ever it does usually |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected D_Vec2D headPosition
protected int faceDirection
protected RingVector objPositions
protected char ownChar
I_PlayFieldConstants
protected long nextUpdateTime
protected long waitCycles
protected final GameParameter parameter
Constructor Detail |
---|
protected C_GameObject()
protected C_GameObject(GameParameter parameter)
protected C_GameObject(D_Vec2D headPosition, int faceDirection, RingVector objPositions, char ownChar, long waitCycles, GameParameter parameter)
headPosition
- faceDirection
- objPositions
- ownChar
- waitCycles
- parameter
- protected C_GameObject(C_GameObject obj)
obj
- protected C_GameObject(D_Vec2D headPosition, int faceDirection, char ownChar, long waitCycles, GameParameter parameter)
headPosition
- faceDirection
- ownChar
- waitCycles
- Method Detail |
---|
protected abstract void jumpTo(D_Vec2D pos, C_Arena arena)
pos
- the desteny position of the head.arena
- protected D_Vec2D[] getAllPosArray()
protected java.util.LinkedList getAllPosList()
protected char getOwnChar()
protected abstract D_Vec2D[] getAllPosSorted(int sort)
sort
- maybe there are more than one way to sort the object positions, this
parameter specifies the kind of sort.
protected int getFaceDirection()
protected void setFaceDirection(int faceDirection)
faceDirection
- The faceDirection to set.protected D_Vec2D getHeadPosition()
protected void setHeadPosition(D_Vec2D headPosition)
headPosition
- a copy of the headPosition to set.protected D_Vec2D getNextPosInFaceDirection(C_Arena arena)
arena
- the arena the object is in
protected long getNextUpdateTime()
protected abstract void update(C_Arena arena)
arena
- the arena the object is living inprotected void jumpHeadPos(D_Vec2D dest)
dest
- the destinationpublic abstract java.lang.String toString()
toString
in class java.lang.Object
protected abstract java.lang.Object clone()
clone
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |