|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectgroup1.model.gameobject.GameObj
group1.model.gameobject.projectile.Projectile
group1.model.gameobject.projectile.Contact
public class Contact
A Contact is a strange type of Projectile.
It is not really a projectile at all in the sense of the usual definition.
Rather, it is attached to a host GameObj to give it damaging power simply by
touching other damageable GameObj's.
Usage: to give a GameObj contact-damage power.
Steps: (1) create an instance of Contact and attach it to a host
GameObj, either in the constructor, or set later;
(2) set this Contact's team to be the same as the host's
team. Do it or else this Contact will fry the host!!!!!
(3) set the attack power;
(4) add this Contact to the host's
Environment.
| Field Summary |
|---|
| Fields inherited from class group1.model.gameobject.GameObj |
|---|
acceleration, ENEMY_TEAM, GRID_SPACE_SIZE, id, isMovable, JEFF_TEAM, myState, NO_TEAM, regions, shape, THICKNESS, velocity |
| Constructor Summary | |
|---|---|
Contact()
Default constructor: sets host object to null. |
|
Contact(double x,
double y,
PictureList p)
Standard factory constructor. |
|
Contact(double x,
double y,
PictureList p,
GameObj newHostObj)
Standard factory constructor specifying host object. |
|
Contact(GameObj newHostObj)
Constructor specifying host object. |
|
| Method Summary | |
|---|---|
char |
getDamageType()
Returns a letter code indicating the type of damage that this Projectile gives. |
GameObj |
getHostObj()
Get the current host object. |
XYPair |
move(Environment env)
Movement function that should be called by the Environment at each time click. |
void |
setDirection(Direction newDirection)
NOT AVAILABLE FOR CONTACT. |
void |
setHostObj(GameObj newHostObj)
Set a new host object. |
void |
setSpeed(double newSpeed)
NOT AVAILABLE FOR CONTACT. |
| Methods inherited from class group1.model.gameobject.projectile.Projectile |
|---|
findObjRegion, getAttackPower, getBottomObjRegion, getDirection, getLeftObjRegion, getRightObjRegion, getSpeed, getTopObjRegion, getVelocityVector, setAttackPower, setProjectileTeam |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Contact()
public Contact(GameObj newHostObj)
public Contact(double x,
double y,
PictureList p)
public Contact(double x,
double y,
PictureList p,
GameObj newHostObj)
| Method Detail |
|---|
public GameObj getHostObj()
public void setHostObj(GameObj newHostObj)
Contact will move to the
position of the new host object.
public char getDamageType()
Contact returns 'c'.
getDamageType in class Projectilepublic void setDirection(Direction newDirection)
setDirection in class Projectilepublic void setSpeed(double newSpeed)
setSpeed in class Projectilepublic XYPair move(Environment env)
Contact moves together with its host object.
move in class Projectileenv - The environment that this object is moving in.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||