|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.lang.Thread | +--lane.sente.GameElement
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 |
protected Location theLocation
protected int radius
protected int health
protected Velocity theVelocity
protected RobotContainer theContainer
Constructor Detail |
public GameElement(Location theLocation, Velocity theVelocity, int radius, int health, RobotContainer theContainer)
theLocation
- The location where this element beginstheVelocity
- The velocity with which this element beginsradius
- The radius of the elementhealth
- The maximum health of this elementtheContainer
- The RobotContainer that holds this elementMethod Detail |
public abstract void xCollision()
public abstract void yCollision()
public abstract void zCollision()
public boolean isCollision(GameElement other)
other
- The game element to check for a collision withprotected abstract void updateListeners()
public abstract void collision(GameElement other)
other
- The game element collided withpublic void setLocation(Location loc)
loc
- the new locationpublic Location getLocation()
public void setRadius(int r)
r
- the new radiuspublic int getRadius()
public void setHealth(int h)
h
- the new health of the elementpublic int getHealth()
health
- the new health of the elementpublic void acceptDammage(int dammage)
dammage
- the amount to subtract from this elements healthpublic Velocity getVelocity()
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |