Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## de.farafin.snEADy.world
Class C_GameObject

    java.lang.Object
      de.farafin.snEADy.world.C_GameObject

All Implemented Interfaces:
  I_Constants, I_PlayFieldConstants

Direct Known Subclasses:
  C_Goody, C_Snake

    public abstract class C_GameObject

extends java.lang.Object
implements I_Constants, I_PlayFieldConstants

all objects in the world should extend fromthis class. this is the representation of the Objects on the playfield. so to say their body.

Version:
  $Revision: 1.20 $
Author:
  roland, lars

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_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_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

### headPosition

    protected D_Vec2D headPosition

  the position of the head. even if the object is larger than one field, it needs a position

### faceDirection

    protected int faceDirection

  the direction the Object faces to

### objPositions

    protected RingVector objPositions

  all positions of the object, inlcuding the head!

### ownChar

    protected char ownChar

  the own representation on the playField

  See Also:
    `I_PlayFieldConstants`

### nextUpdateTime

    protected long nextUpdateTime

  when is the object updated next time? if its negative, the object will never be updated

### waitCycles

    protected long waitCycles

  the freuency with what the gaObject should be updated. if its negative, the nextUpdateTime never changes

### parameter

    protected final GameParameter parameter

  parameter set of GameParameter

Constructor Detail

### C_GameObject

    protected C_GameObject()

  default constructor

### C_GameObject

    protected C_GameObject(GameParameter parameter)

  default constructor

### C_GameObject

    protected C_GameObject(D_Vec2D headPosition,
                           int faceDirection,
                           RingVector objPositions,
                           char ownChar,
                           long waitCycles,
                           GameParameter parameter)

  create constructor

  Parameters:
    `headPosition` -
    `faceDirection` -
    `objPositions` -
    `ownChar` -
    `waitCycles` -
    `parameter` -

### C_GameObject

    protected C_GameObject(C_GameObject obj)

  copy constructor reference-copy of attrbutes: use copy() if you need a full copy

  Parameters:
    `obj` -

### C_GameObject

    protected C_GameObject(D_Vec2D headPosition,
                           int faceDirection,
                           char ownChar,
                           long waitCycles,
                           GameParameter parameter)

  constructor

  Parameters:
    `headPosition` -
    `faceDirection` -
    `ownChar` -
    `waitCycles` -

Method Detail

### jumpTo

    protected abstract void jumpTo(D_Vec2D pos,
                                   C_Arena arena)

  moves the object with all its positions to the specific position.

  Parameters:
    `pos` - the desteny position of the head.
    `arena` -

### getAllPosArray

    protected D_Vec2D[] getAllPosArray()

  Returns:
    an unsorted array of all positions of the object. (it is no Copy!)

### getAllPosList

    protected java.util.LinkedList getAllPosList()

  Returns:
    an unsorted LinkedList of all positions of the object.(it is no Copy!)

### getOwnChar

    protected char getOwnChar()

  Returns:
    Returns the own char.

### getAllPosSorted

    protected abstract D_Vec2D[] getAllPosSorted(int sort)

  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.

### getFaceDirection

    protected int getFaceDirection()

  Returns:
    Returns the faceDirection.

### setFaceDirection

    protected void setFaceDirection(int faceDirection)

  Parameters:
    `faceDirection` - The faceDirection to set.

### getHeadPosition

    protected D_Vec2D getHeadPosition()

  Returns:
    Returns a copy of the headPosition.

### setHeadPosition

    protected void setHeadPosition(D_Vec2D headPosition)

  Parameters:
    `headPosition` - a copy of the headPosition to set.

### getNextPosInFaceDirection

    protected D_Vec2D getNextPosInFaceDirection(C_Arena arena)

  returns the next position if the object would move one fieled in its face direction. That includes the case that he is at the end of the world and would jump to the oppiside side. remember the world is no disc, still a squared shpere!! :D

  Parameters:
    `arena` - the arena the object is in
  Returns:
    the new position

### getNextUpdateTime

    protected long getNextUpdateTime()

  Returns:
    Returns the nextUpdateTime.

### update

    protected abstract void update(C_Arena arena)

  the update call meens that the object should do what ever it does usually

  Parameters:
    `arena` - the arena the object is living in

### jumpHeadPos

    protected void jumpHeadPos(D_Vec2D dest)

  Moves only the head and the zero-element of the position-list to the new position

  Parameters:
    `dest` - the destination

### toString

    public abstract java.lang.String toString()

  Overrides:
    `toString` in class `java.lang.Object`

### clone

    protected abstract java.lang.Object clone()

  Overrides:
    `clone` in class `java.lang.Object`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD