de.farafin.snEADy.world
Class C_Goody

java.lang.Object
  extended by de.farafin.snEADy.world.C_GameObject
      extended by de.farafin.snEADy.world.C_Goody
All Implemented Interfaces:
I_Constants, I_PlayFieldConstants
Direct Known Subclasses:
C_GLength, C_GPoints, C_GSpeed

public abstract class C_Goody
extends C_GameObject

Author:
lars, roland TODO what does that class do?

Field Summary
 
Fields inherited from class de.farafin.snEADy.world.C_GameObject
faceDirection, headPosition, nextUpdateTime, objPositions, ownChar, parameter, waitCycles
 
Fields inherited from interface de.farafin.snEADy.communication.I_Constants
analyse_ms, auto_grow_delay, auto_slowdown_delay, closemonitor, commandConstants, damage_length_grow, damage_points_radius, DEBUG, delplayer, easy_points, emergencyPause, exit_time, FACE_EAST, FACE_NORTH, FACE_SOUTH, FACE_WEST, goody_length_occ, goody_length_value, goody_points_occ, goody_points_value, goody_shorter_occ, goody_shorter_value, goody_slowdown_occ, goody_speed_occ, IN_ACTION, IN_ERROR_EXC, IN_ERROR_INIT, IN_ERROR_SPACE, IN_ERROR_TIME, IN_EXIT, IN_HEAVEN, init_length, init_move_delay, kill, kill_point_goodies, kill_points_radius, loadhuman, loadlevel, loadplayer, logging, max_goody_occ_delay, MAX_HUMAN_PLAYERS, max_mem_check_delay, max_move_delay, max_player_mem, MAX_PLAYERS, max_thinking_ms, min_cycle_ms, min_move_delay, openmonitor, overalldelay, pause, print_calc_ms, print_parameter, print_player_mem, print_playfield, quit, run, show_subcycles, start, stop, suddend_time, survival_points, timeout_ms, TURN_LEFT, TURN_NONE, TURN_RIGHT
 
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_Goody()
          default constructor
protected C_Goody(D_Vec2D headPosition, int faceDirection, char ownChar, long waitCycles, GameParameter parameter)
           
protected C_Goody(D_Vec2D headPosition, int faceDirection, RingVector objPositions, char ownChar, long waitCycles, GameParameter parameter)
           
protected C_Goody(GameParameter parameter)
          constructor
 
Method Summary
protected abstract  java.lang.Object clone()
           
protected  D_Vec2D[] getAllPosSorted(int sort)
           
protected  void jumpTo(D_Vec2D pos, C_Arena arena)
          moves the object with all its positions to the specific position.
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
protected  void wasEaten(C_Snake snake, C_Arena arena)
          this method is called when the goody was eaten by a snake.
protected abstract  void wasEatenBy(C_Snake snake)
          this method describes what happends to the snake if the goody was eaten.
 
Methods inherited from class de.farafin.snEADy.world.C_GameObject
getAllPosArray, getAllPosList, getFaceDirection, getHeadPosition, getNextPosInFaceDirection, getNextUpdateTime, getOwnChar, jumpHeadPos, setFaceDirection, setHeadPosition
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

C_Goody

protected C_Goody()
default constructor


C_Goody

protected C_Goody(GameParameter parameter)
constructor

Parameters:
parameter -

C_Goody

protected C_Goody(D_Vec2D headPosition,
                  int faceDirection,
                  char ownChar,
                  long waitCycles,
                  GameParameter parameter)
Parameters:
headPosition -
faceDirection -
ownChar -
waitCycles -
parameter -

C_Goody

protected C_Goody(D_Vec2D headPosition,
                  int faceDirection,
                  RingVector objPositions,
                  char ownChar,
                  long waitCycles,
                  GameParameter parameter)
Parameters:
headPosition -
faceDirection -
objPositions -
ownChar -
waitCycles -
parameter -
Method Detail

jumpTo

protected void jumpTo(D_Vec2D pos,
                      C_Arena arena)
Description copied from class: C_GameObject
moves the object with all its positions to the specific position.

Specified by:
jumpTo in class C_GameObject
Parameters:
pos - the desteny position of the head.

getAllPosSorted

protected D_Vec2D[] getAllPosSorted(int sort)
Specified by:
getAllPosSorted in class C_GameObject
Parameters:
sort - maybe there are more than one way to sort the object positions, this parameter specifies the kind of sort.
Returns:
an sorted array of all posistions of the object.

update

protected abstract void update(C_Arena arena)
Description copied from class: C_GameObject
the update call meens that the object should do what ever it does usually

Specified by:
update in class C_GameObject
Parameters:
arena - the arena the object is living in

wasEatenBy

protected abstract void wasEatenBy(C_Snake snake)
this method describes what happends to the snake if the goody was eaten. dont call this method from out of the goody-line. it is not good because the goody is not delated from the arena if this one is called.

Parameters:
snake - the snake that ate the goody

wasEaten

protected void wasEaten(C_Snake snake,
                        C_Arena arena)
this method is called when the goody was eaten by a snake. The object will be delated from the arena please use this method out of the snake if you want to describe the eating process.

Parameters:
snake - the snae that ate the goody
arena - the arena the goody was eaten in

toString

public abstract java.lang.String toString()
Specified by:
toString in class C_GameObject

clone

protected abstract java.lang.Object clone()
Specified by:
clone in class C_GameObject