java.lang.ObjectLaser
public class Laser
A Laser that can move and draw itself
Constructor Summary | |
---|---|
Laser(Defender d)
Constructs a new Laser based on the position of the Defender |
|
Laser(int startXPosition,
int startYPosition,
int xVelocity,
int yVelocity)
Constructs a Laser based on the given location and velocity |
Method Summary | |
---|---|
int |
getXPosition()
Get the current x coordinate of the center of this Laser. |
int |
getYPosition()
Get the current y coordinate of the center of this Laser. |
boolean |
isDefenderLaser()
Returns true if the Defender fired this Laser |
void |
paint(java.awt.Graphics g)
Paint this Laser onto the given Graphics object |
boolean |
removeMeFromGame()
Returns true if this Laser has left the game area. |
void |
takeOneStep()
Updates the position of the Laser for the next time it is redrawn. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Laser(int startXPosition, int startYPosition, int xVelocity, int yVelocity)
startXPosition
- the starting x positionstartYPosition
- the starting y positionxVelocity
- the starting x velocityyVelocity
- the starting y velocitypublic Laser(Defender d)
d
- the DefenderMethod Detail |
---|
public boolean isDefenderLaser()
public void takeOneStep()
public boolean removeMeFromGame()
public void paint(java.awt.Graphics g)
g
- the Graphics object to draw ontopublic int getXPosition()
public int getYPosition()