lane.sente
Class GameElement

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--lane.sente.GameElement
All Implemented Interfaces:
java.lang.Runnable
Direct Known Subclasses:
AnimateGameElement, InanimateGameElement

public abstract class GameElement
extends java.lang.Thread

This is the base class from which all Elements in the Gaming area are derived It has information common to all of them such as health, speed, location and size


Field Summary
protected  int health
           
protected  int radius
           
protected  RobotContainer theContainer
           
protected  Location theLocation
           
protected  Velocity theVelocity
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
GameElement(Location theLocation, Velocity theVelocity, int radius, int health, RobotContainer theContainer)
          the constructor for the game element
 
Method Summary
 void acceptDammage(int dammage)
          the method used to cause dammage to the element
abstract  void collision(GameElement other)
          each particular type of element will decide what to do when it coolides with another object (bullets, robots etc....)
 int getHealth()
          the method used to get the health of this element
 Location getLocation()
          method used to get element location
 int getRadius()
          the method used to get the raduis of this element
 Velocity getVelocity()
          the method used to get the velocity of the element
 boolean isCollision(GameElement other)
          Checks weather this element is currently touching another element
 void setHealth(int h)
          the method used to set the health of the element
 void setLocation(Location loc)
          method used to set element location
 void setRadius(int r)
          The method used to set the raduis of the element
protected abstract  void updateListeners()
          The method called when a subclass wants to update its listeners
abstract  void xCollision()
          the method to handle collisions with the x axis wall
abstract  void yCollision()
          the method to handle collisions with the y axis wall
abstract  void zCollision()
          the method to handle collisions with the z axis wall
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, run, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

theLocation

protected Location theLocation

radius

protected int radius

health

protected int health

theVelocity

protected Velocity theVelocity

theContainer

protected RobotContainer theContainer
Constructor Detail

GameElement

public GameElement(Location theLocation,
                   Velocity theVelocity,
                   int radius,
                   int health,
                   RobotContainer theContainer)
the constructor for the game element
Parameters:
theLocation - The location where this element begins
theVelocity - The velocity with which this element begins
radius - The radius of the element
health - The maximum health of this element
theContainer - The RobotContainer that holds this element
Method Detail

xCollision

public abstract void xCollision()
the method to handle collisions with the x axis wall

yCollision

public abstract void yCollision()
the method to handle collisions with the y axis wall

zCollision

public abstract void zCollision()
the method to handle collisions with the z axis wall

isCollision

public boolean isCollision(GameElement other)
Checks weather this element is currently touching another element
Parameters:
other - The game element to check for a collision with

updateListeners

protected abstract void updateListeners()
The method called when a subclass wants to update its listeners

collision

public abstract void collision(GameElement other)
each particular type of element will decide what to do when it coolides with another object (bullets, robots etc....)
Parameters:
other - The game element collided with

setLocation

public void setLocation(Location loc)
method used to set element location
Parameters:
loc - the new location

getLocation

public Location getLocation()
method used to get element location
Returns:
the Location of the element

setRadius

public void setRadius(int r)
The method used to set the raduis of the element
Parameters:
r - the new radius

getRadius

public int getRadius()
the method used to get the raduis of this element
Returns:
the radius of the element

setHealth

public void setHealth(int h)
the method used to set the health of the element
Parameters:
h - the new health of the element

getHealth

public int getHealth()
the method used to get the health of this element
Parameters:
health - the new health of the element

acceptDammage

public void acceptDammage(int dammage)
the method used to cause dammage to the element
Parameters:
dammage - the amount to subtract from this elements health

getVelocity

public Velocity getVelocity()
the method used to get the velocity of the element
Returns:
the velocity of the element