public class CurvedPlatform extends StationaryPlatform
| Modifier and Type | Field and Description |
|---|---|
static double[] |
CURVE_X1
Predetermined x coordinates of Bezier Curve controls points for curve 1
|
static double[] |
CURVE_X2
Predetermined x coordinates of Bezier Curve controls points for curve 2
|
static double[] |
CURVE_X3
Predetermined x coordinates of Bezier Curve controls points for curve 3
|
static double[] |
CURVE_X4
Predetermined x coordinates of Bezier Curve controls points for curve 4
|
static double[] |
CURVE_X5
Predetermined x coordinates of Bezier Curve controls points for curve 5
|
int |
curveId
Stores the ID of the curve
|
double[] |
curveX1
Stores x coordinates of Bezier Curve control points for curve 1
|
double[] |
curveX2
Stores x coordinates of Bezier Curve control points for curve 2
|
double[] |
curveX3
Stores x coordinates of Bezier Curve control points for curve 3
|
double[] |
curveX4
Stores x coordinates of Bezier Curve control points for curve 4
|
double[] |
curveX5
Stores x coordinates of Bezier Curve control points for curve 5
|
double[] |
curveY1
Stores y coordinates of Bezier Curve control points for curve 1
|
double[] |
curveY2
Stores y coordinates of Bezier Curve control points for curve 2
|
double[] |
curveY3
Stores y coordinates of Bezier Curve control points for curve 3
|
double[] |
curveY4
Stores y coordinates of Bezier Curve control points for curve 4
|
double[] |
curveY5
Stores y coordinates of Bezier Curve control points for curve 5
|
Section |
section
Stores the map section the curve is located in
|
boolean |
takeOff
Identifies if Sonic can take off from this curve
|
int |
xDir
Stores the x direction the curve is facing
|
degree, gravity, GRAVITY, h, TURN_ON_ANIM, w, x, y, yDir| Constructor and Description |
|---|
CurvedPlatform()
The default constructor
|
CurvedPlatform(double x,
double y,
double w,
double h,
Section section,
int xDir)
The general constructor used to create the curved platform
|
| Modifier and Type | Method and Description |
|---|---|
void |
findControlPoints()
Giving each curve an Id and offsetting the x coordiantes of the control points depending on the section
|
java.awt.geom.Line2D |
getContactLine()
Empty function body since the function is not being used
|
double[] |
getCurveX()
Gets the the array storing the x coordinates of the control points of a curve
|
double[] |
getCurveY()
Gets the the array storing the y coordinates of the control points of a curve
|
double |
getCurveYBase(Unit gameObject)
Gets the y coordinate of the curve where the gameObject's x coordinate is located
|
void |
interact(GameObject gameObject)
Describes the interaction between the curve and the object it is interacting with
|
void |
paint(java.awt.Graphics g)
Draws the Bezier curve
|
calculateAngle, calculateT, updatechangeXDir, changeYDirpublic static final double[] CURVE_X1
public static final double[] CURVE_X2
public static final double[] CURVE_X3
public static final double[] CURVE_X4
public static final double[] CURVE_X5
public double[] curveX1
public double[] curveY1
public double[] curveX2
public double[] curveY2
public double[] curveX3
public double[] curveY3
public double[] curveX4
public double[] curveY4
public double[] curveX5
public double[] curveY5
public Section section
public int curveId
public int xDir
public boolean takeOff
public CurvedPlatform()
public CurvedPlatform(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 curve is located inxDir - The x direction the curve is facingpublic double[] getCurveX()
public double[] getCurveY()
public double getCurveYBase(Unit gameObject)
gameObject - The object the curve is using to find the y coordinate of the curve depending on the x value of the game objectpublic 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 curve is interacting withpublic void findControlPoints()