public class VertMovingRect 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
|
boolean |
landedOn
Identifies if Sonic has landed on this platform or not
|
Section |
section
Stores map section the platform is located in
|
double |
ySpeed
The y speed of the platform when falling
|
| Constructor and Description |
|---|
VertMovingRect()
The default constructor
|
VertMovingRect(double x,
double y,
double w,
double h,
Section section,
int yDir)
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 y movements
|
changeXDir, changeYDirpublic static final java.lang.String IMAGE_FILENAME
public java.awt.image.BufferedImage image
public Section section
public boolean landedOn
public double ySpeed
public VertMovingRect()
public VertMovingRect(double x,
double y,
double w,
double h,
Section section,
int yDir)
x - The x coordinate of the objecty - The y coordinate of the objectw - The width of the objecth - The height of the objectsection - The section the platform is located inxDir - The y 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 with