public class Section
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static java.awt.Color |
BADNIK_MOB
Detected a Badnik dyrubg color detection
|
static int |
DETECT_SF_STATE_NONE
Has not detected a stage feature yet during color detection
|
java.util.Vector<GameObject> |
gameObjects
Stores all the game objects in the current section
|
boolean |
hasNextSection
Identifying if another section after the current one exists
|
java.awt.image.BufferedImage |
mapImage
Stores the map image
|
java.lang.String |
mapImageFilename
The filename of the image of the sections
|
java.awt.image.BufferedImage |
mapMaskImage
Stores the mask image
|
java.lang.String |
mapMaskImageFilename
The filename of the image of the masked sections
|
int |
sectionIndex
The index of the section vector
|
double |
sectionStartX
The x coordinate of the current section
|
double |
sectionStartY
The y coordinate of the current section
|
static java.awt.Color |
STAGE_FEATURE_1_WAY_BARRIER
Detected a 1-way barrier during color detection
|
static java.awt.Color |
STAGE_FEATURE_BARRIER
Detected a barrier during color detection
|
static java.awt.Color |
STAGE_FEATURE_CURVE_PLATFORM
Detected a curved platform during color detection
|
static java.awt.Color |
STAGE_FEATURE_HORZ_MOVING_RECT
Detected a horizontal, moving rectangular platform during color detection
|
static java.awt.Color |
STAGE_FEATURE_INCLINE_PLATFORM
Detected a inclined platform during color detection
|
static java.awt.Color |
STAGE_FEATURE_LOOP
Detected a loop during color detection
|
static java.awt.Color |
STAGE_FEATURE_PROP
Detected a prop during color detection
|
static java.awt.Color |
STAGE_FEATURE_RECT_PLATFORM
Detected a rectangular platform during color detection
|
static java.awt.Color |
STAGE_FEATURE_S_CURVE
Detected an S-Curve during color detection
|
static java.awt.Color |
STAGE_FEATURE_SPIKE
Detected a spike during color detection
|
static java.awt.Color |
STAGE_FEATURE_VERT_MOVING_RECT
Detected a vertical, moving rectangular platform during color detection
|
| Constructor and Description |
|---|
Section()
The default constructor
|
Section(java.lang.String mapImageFilename,
java.lang.String mapMaskImageFilename,
double sectionStartX,
double sectionStartY,
int sectionIndex,
boolean hasNextSection,
ImageManager imageManager)
The general constructor used to create the map section
|
| Modifier and Type | Method and Description |
|---|---|
GameObject |
collisionDetection(GameObject gameObject,
boolean checkingForBarrier,
boolean isNotLandable,
boolean landingOnLoop1,
boolean checkingForBadniks)
Handling the collision detection for the current section
|
void |
detectCurveInfoAndRemove(java.awt.image.BufferedImage maskImage,
int startPosX,
int startPosY)
Detects curved game objects with the same color
|
void |
detectInclineInfoAndRemove(java.awt.image.BufferedImage maskImage,
int startPosX,
int startPosY)
Detects inclined game objects with the same color
|
void |
detectLoopInfoAndRemove(java.awt.image.BufferedImage maskImage,
int startPosX,
int startPosY)
Detects loop game objects with the same color
|
void |
detectRectInfoAndRemove(java.awt.image.BufferedImage maskImage,
int startPosX,
int startPosY,
java.awt.Color color,
boolean isOneWay,
ImageManager imageManager)
Detects rectangular game objects with the same color
|
void |
detectSCurveInfoAndRemove(java.awt.image.BufferedImage maskImage,
int startPosX,
int startPosY)
Detects S-Curve game objects with the same color
|
void |
detectSpikeInfoAndRemove(java.awt.image.BufferedImage maskImage,
int startPosX,
int startPosY)
Detects spiked game objects with the same color
|
void |
detectStageFeatures(java.awt.image.BufferedImage maskImage,
ImageManager imageManager)
Detecting the game objects in the mask image
|
GameObject |
getGameObject(int index)
Gets the game object
|
void |
paint(java.awt.Graphics g)
Drawing the image of the current section and the game objects
|
void |
removeGameObject(GameObject object)
Removing the given game objects
|
void |
update()
Updating all the game objects in the section
|
public static final int DETECT_SF_STATE_NONE
public static final java.awt.Color STAGE_FEATURE_RECT_PLATFORM
public static final java.awt.Color STAGE_FEATURE_INCLINE_PLATFORM
public static final java.awt.Color STAGE_FEATURE_CURVE_PLATFORM
public static final java.awt.Color STAGE_FEATURE_BARRIER
public static final java.awt.Color STAGE_FEATURE_PROP
public static final java.awt.Color STAGE_FEATURE_SPIKE
public static final java.awt.Color STAGE_FEATURE_LOOP
public static final java.awt.Color STAGE_FEATURE_1_WAY_BARRIER
public static final java.awt.Color STAGE_FEATURE_S_CURVE
public static final java.awt.Color STAGE_FEATURE_HORZ_MOVING_RECT
public static final java.awt.Color STAGE_FEATURE_VERT_MOVING_RECT
public static final java.awt.Color BADNIK_MOB
public java.lang.String mapImageFilename
public java.lang.String mapMaskImageFilename
public java.awt.image.BufferedImage mapImage
public java.awt.image.BufferedImage mapMaskImage
public double sectionStartX
public double sectionStartY
public int sectionIndex
public boolean hasNextSection
public java.util.Vector<GameObject> gameObjects
public Section()
public Section(java.lang.String mapImageFilename,
java.lang.String mapMaskImageFilename,
double sectionStartX,
double sectionStartY,
int sectionIndex,
boolean hasNextSection,
ImageManager imageManager)
mapImageFilename - The file names of the map background imagemapMaskImageFilename - The file names of the mask imagesectionStartX - The x coordinate of the current sectionsectionStartY - The y coordinate of the current sectionsectionIndex - The index of the current sectionhasNextSection - Identifying if another section after the current one existsimageManager - A hashmap containing all of the sprite animationspublic GameObject getGameObject(int index)
index - The index the game object is located inpublic void paint(java.awt.Graphics g)
g - An instance of the Graphics objectpublic void update()
public GameObject collisionDetection(GameObject gameObject, boolean checkingForBarrier, boolean isNotLandable, boolean landingOnLoop1, boolean checkingForBadniks)
gameObject - The object checking for collisionscheckingForBarrier - Checking for barrierisNotLandable - Checking for a landable stage featurelandingOnLoop1 - Checking to land on the 1st section of the loop-the-loopcheckingForBadniks - Checking for badniks (mobs)public void detectStageFeatures(java.awt.image.BufferedImage maskImage,
ImageManager imageManager)
maskImage - The image used to detect the game objectsimageManager - A hashmap containing all of the sprite animationspublic void detectRectInfoAndRemove(java.awt.image.BufferedImage maskImage,
int startPosX,
int startPosY,
java.awt.Color color,
boolean isOneWay,
ImageManager imageManager)
maskImage - MaskImage of the sectionstartPosX - The starting x coordinate of the game objectstartPosY - The starting y coordinate of the game objectcolor - The color of the game objectisOneWay - Identifies if the barrier is 1 wayimageManager - A hashmap containing all of the sprite animationspublic void detectInclineInfoAndRemove(java.awt.image.BufferedImage maskImage,
int startPosX,
int startPosY)
maskImage - MaskImage of the sectionstartPosX - The starting x coordinate of the game objectstartPosY - The starting y coordinate of the game objectpublic void detectCurveInfoAndRemove(java.awt.image.BufferedImage maskImage,
int startPosX,
int startPosY)
maskImage - MaskImage of the sectionstartPosX - The starting x coordinate of the game objectstartPosY - The starting y coordinate of the game objectpublic void detectSpikeInfoAndRemove(java.awt.image.BufferedImage maskImage,
int startPosX,
int startPosY)
maskImage - MaskImage of the sectionstartPosX - The starting x coordinate of the game objectstartPosY - The starting y coordinate of the game objectpublic void detectLoopInfoAndRemove(java.awt.image.BufferedImage maskImage,
int startPosX,
int startPosY)
maskImage - MaskImage of the sectionstartPosX - The starting x coordinate of the game objectstartPosY - The starting y coordinate of the game objectpublic void detectSCurveInfoAndRemove(java.awt.image.BufferedImage maskImage,
int startPosX,
int startPosY)
maskImage - MaskImage of the sectionstartPosX - The starting x coordinate of the game objectstartPosY - The starting y coordinate of the game objectpublic void removeGameObject(GameObject object)
object - The game object to remove