public class Barrier extends StationaryPlatform
| Modifier and Type | Field and Description |
|---|---|
boolean |
isOneWay
Identifies if Sonic can go through the barrier only in 1 direction
|
| Constructor and Description |
|---|
Barrier()
The default constructor
|
Barrier(double x,
double y,
double w,
double h,
boolean isOneWay)
The general constructor used to create a barrier
|
| Modifier and Type | Method and Description |
|---|---|
java.awt.geom.Line2D |
getBottomContactLine()
Gets the bottom contact line of the barrier's hitbox
|
java.awt.geom.Line2D |
getContactLine()
Gets the left contact line of the barrier's hitbox
|
java.awt.geom.Line2D |
getRightContactLine()
Gets the right contact line of the barrier's hitbox
|
java.awt.geom.Line2D |
getTopContactLine()
Gets the top contact line of the barrier's hitbox
|
void |
interact(GameObject gameObject)
Describes the interaction between the barrier and the object it is interacting with
|
void |
paint(java.awt.Graphics g)
Draws the barrier's hitbox
|
calculateAngle, calculateT, updatechangeXDir, changeYDirpublic boolean isOneWay
public Barrier()
public Barrier(double x,
double y,
double w,
double h,
boolean isOneWay)
x - The x coordinate of the objecty - The y coordinate of the objectw - The width of the objecth - The height of the objectisOneWay - Identifies if Sonic can go through the barrier in 1 directionpublic java.awt.geom.Line2D getTopContactLine()
public java.awt.geom.Line2D getRightContactLine()
public java.awt.geom.Line2D getBottomContactLine()
public java.awt.geom.Line2D getContactLine()
getContactLine in class StationaryPlatformpublic void paint(java.awt.Graphics g)
paint in class StationaryPlatformg - An instance of the Graphics objectpublic void interact(GameObject gameObject)
interact in class StationaryPlatformgameObject - The object the barrier is interacting with