|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object group1.model.gameobject.GameObj group1.model.gameobject.projectile.Projectile
public class Projectile
A Projectile is a flying object that directly gives damage to another game object. Projectiles are emitted by Jeff or enemies as weapons.
Usage: construct the Projectile, then set its attack power, speed, and direction.
Field Summary |
---|
Fields inherited from class group1.model.gameobject.GameObj |
---|
acceleration, ENEMY_TEAM, GRID_SPACE_SIZE, id, isMovable, JEFF_TEAM, NO_TEAM, regions, shape, velocity |
Constructor Summary | |
---|---|
Projectile()
Creates an idle Projectile. |
Method Summary | |
---|---|
ObjRegion |
findObjRegion(int side)
Finds an occurrence of an ObjRegion for this object that is on the specified side. |
double |
getAttackPower()
Returns the attack power of the Projectile, which is the amount of damage that it gives to a GameObj that it hits. |
ObjRegion |
getBottomObjRegion()
Returns the ObjRegion on the bottom side of the Projectile that gives damage. |
char |
getDamageType()
Returns a letter code indicating the type of damage that this Projectile gives. |
Direction |
getDirection()
Returns the horizontal direction of the Projectile. |
ObjRegion |
getLeftObjRegion()
Returns the ObjRegion on the left side of the Projectile that gives damage. |
ObjRegion |
getRightObjRegion()
Returns the ObjRegion on the right side of the Projectile that gives damage. |
double |
getSpeed()
Returns the speed (magnitude of velocity) of the Projectile. |
ObjRegion |
getTopObjRegion()
Returns the ObjRegion on the top side of the Projectile that gives damage. |
XYPair |
getVelocityVector()
Gives the current velocity vector of the Projectile, based on its current speed and direction. |
XYPair |
move(Environment env)
Movement function that should be called by the Environment at each time click. |
void |
setAttackPower(double newAttackPower)
Sets this Projectile to give the specified amount of damage. |
void |
setDirection(Direction newDirection)
Sets the horizontal direction of this Projectile. |
void |
setSpeed(double newSpeed)
Sets the speed (magnitude of velocity) of this Projectile. |
Methods inherited from class group1.model.gameobject.GameObj |
---|
addRegion, addRegion, equals, getAcceleration, getAccelerationX, getAccelerationY, getFilm, getFilm, getHeight, getID, getNumRegions, getPictureList, getPosition, getPositionX, getPositionY, getRectangle, getRegion, getState, getTeam, getVelocity, getVelocityX, getVelocityY, getWidth, intersectRegions, isMovable, isSameState, makeRegions, makeSolid, makeSolidTop, setAcceleration, setAcceleration, setAccelerationX, setAccelerationY, setID, setPictureList, setPosition, setPosition, setPositionX, setPositionY, setRectangle, setSize, setState, setTeam, setVelocity, setVelocity, setVelocityX, setVelocityY, stopHorizontal, stopVertical |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Projectile()
Method Detail |
---|
public char getDamageType()
public double getAttackPower()
public Direction getDirection()
public double getSpeed()
public ObjRegion getLeftObjRegion()
public ObjRegion getRightObjRegion()
public ObjRegion getTopObjRegion()
public ObjRegion getBottomObjRegion()
public XYPair getVelocityVector()
public ObjRegion findObjRegion(int side)
side
- Constant from ObjRegion denoting which side the
ObjRegion is on.
public void setAttackPower(double newAttackPower)
public void setDirection(Direction newDirection)
public void setSpeed(double newSpeed)
public XYPair move(Environment env)
move
in class GameObj
env
- The environment that this object is moving in.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |