public class Laser
extends java.awt.Polygon
GameBoard
,
SpaceShip
,
Serialized FormModifier and Type | Field and Description |
---|---|
private double |
centerX |
private double |
centerY |
(package private) int |
gameBoardHeight |
(package private) int |
gameBoardWidth |
private int |
laserHeight |
private int |
laserWidth |
private double |
movingAngle |
boolean |
onScreen |
static int[] |
polyXArray |
static int[] |
polyYArray |
private double |
xVelocity |
private double |
yVelocity |
Constructor and Description |
---|
Laser(double centerX,
double centerY,
double movingAngle)
Constructor for Laser sets the center point, velocity, and visibility to true.
|
Modifier and Type | Method and Description |
---|---|
void |
changeXPosition(double increaseAmount)
Used to increase the x position by a set amount.
|
void |
changeYPosition(double increaseAmount)
Used to increase the y position by a set amount.
|
java.awt.Rectangle |
getBounds() |
int |
getHeight() |
double |
getMovingAngle() |
int |
getWidth() |
double |
getXCenter() |
double |
getXVelocity() |
double |
getYCenter() |
double |
getYVelocity() |
double |
laserXMoveAngle(double movingAngle)
Returns the angle in the X direction in radians in which the laser should move in.
|
double |
laserYMoveAngle(double movingAngle)
Returns the angle in the Y direction in radians in which the laser should move in.
|
void |
move()
Handles the movement of the laser on the screen.
|
void |
setMovingAngle(double movingAngle) |
void |
setXCenter(double xCenter) |
void |
setXVelocity(double xVelocity) |
void |
setYCenter(double yCenter) |
void |
setYVelocity(double yVelocity) |
int gameBoardWidth
int gameBoardHeight
private double centerX
private double centerY
public static int[] polyXArray
public static int[] polyYArray
private int laserWidth
private int laserHeight
public boolean onScreen
private double movingAngle
private double xVelocity
private double yVelocity
public Laser(double centerX, double centerY, double movingAngle)
public double getXCenter()
public double getYCenter()
public void setXCenter(double xCenter)
public void setYCenter(double yCenter)
public double getXVelocity()
public double getYVelocity()
public void setXVelocity(double xVelocity)
public void setYVelocity(double yVelocity)
public int getWidth()
public int getHeight()
public void setMovingAngle(double movingAngle)
public double getMovingAngle()
public void changeXPosition(double increaseAmount)
increaseAmount
- the amount to increase bypublic void changeYPosition(double increaseAmount)
increaseAmount
- the amount to increase bypublic java.awt.Rectangle getBounds()
getBounds
in interface java.awt.Shape
getBounds
in class java.awt.Polygon
public double laserYMoveAngle(double movingAngle)
public double laserXMoveAngle(double movingAngle)
public void move()