public class HorzMovingRect extends MovingPlatform
| Modifier and Type | Field and Description |
|---|---|
java.awt.image.BufferedImage |
image
Stores the image
|
static java.lang.String |
IMAGE_FILENAME
The filename of the image representing the platform
|
int |
originalX
The initial x coordinate of the platform
|
Section |
section
Stores the map section the platform is located in
|
double |
xSpeed
Stores the x speed of the platform
|
| Constructor and Description |
|---|
HorzMovingRect()
The default constructor
|
HorzMovingRect(double x,
double y,
double w,
double h,
Section section,
int xDir)
The general constructor used to create the platform
|
| Modifier and Type | Method and Description |
|---|---|
java.awt.geom.Line2D |
getContactLine()
Gets the top contact line of the platforms's hitbox
|
void |
interact(GameObject gameObject)
Describes the interaction between the platform and the object it is interacting with
|
void |
paint(java.awt.Graphics g)
Draws the image and the hitbox of the platform
|
void |
update()
Updates the platform's movements
|
void |
updateXSpeed()
Updates the platform's x speed
|
changeXDir, changeYDirpublic static final java.lang.String IMAGE_FILENAME
public java.awt.image.BufferedImage image
public Section section
public int originalX
public double xSpeed
public HorzMovingRect()
public HorzMovingRect(double x,
double y,
double w,
double h,
Section section,
int xDir)
x - The x coordinate of the objecty - The y coordinate of the objectw - The width of the objecth - The height of the objectsection - The map section the platform is located inxDir - The x direction of the objectpublic java.awt.geom.Line2D getContactLine()
getContactLine in class MovingPlatformpublic void paint(java.awt.Graphics g)
paint in class MovingPlatformg - An instance of the Graphics objectpublic void update()
update in class MovingPlatformpublic void interact(GameObject gameObject)
interact in class MovingPlatformgameObject - The object the platform is interacting withpublic void updateXSpeed()