public class LevelModel
extends java.util.Observable
implements java.lang.Runnable
Constructor and Description |
---|
LevelModel(AudioLoadHelper audioLoadHelper)
Class constructor (editor mode)
|
LevelModel(java.lang.String levelName,
AudioLoadHelper audioLoadHelper)
Class constructor
|
LevelModel(java.lang.String levelName,
AudioLoadHelper audioLoadHelper,
java.lang.String mode)
Class constructor
|
Modifier and Type | Method and Description |
---|---|
void |
checkConstraints()
Returns whether constraints on model are respected or not
|
int |
countDiamonds()
Returns number of diamonds
|
int |
decrementCursorXPosition()
Decrements the cursor position X value
|
int |
decrementCursorYPosition()
Decrements the cursor position Y value
|
void |
deleteThisBoulder(int x,
int y)
Deletes the BoulderModel[x][y]
|
void |
expandThisWallToLeft(int x,
int y)
Expand the ExpandingWallModel to left
|
void |
expandThisWallToRight(int x,
int y)
Expand the ExpandingWallModel to right
|
void |
exploseGround(int x,
int y)
When a boulder is falling on Rockford there is an explosion around him
|
void |
exploseThisBrickWall(int x,
int y)
Explose the brick wall
|
java.awt.image.BufferedImage |
getCursorImage()
Gets the cursor image image
|
int |
getCursorXPosition()
Gets the cursor position X value
|
int |
getCursorYPosition()
Gets the cursor position Y value
|
DisplayableElementModel |
getDisplayableElement(int x,
int y)
Gets the displayable element at given positions
|
GameInformationModel |
getGameInformationModel()
Gets gameInformationModel
|
boolean |
getGamePaused()
Get the gamePaused variable
|
DisplayableElementModel[][] |
getGroundLevelModel()
Gets the ground level model
|
java.awt.image.BufferedImage |
getImage(int x,
int y)
Gets the image at given positions
|
LevelLoadHelper |
getLevelLoadHelper()
Gets the associated level load helper
|
java.lang.String |
getMode()
Get the mode where this levelModel is used
|
RockfordModel |
getRockford()
Gets the Rockford object instance
|
int |
getRockfordPositionX()
Gets the horizontal position of Rockford from the model
|
int |
getRockfordPositionY()
Gets the vertical position of Rockford from the model
|
boolean |
getShowCursor()
Gets whether cursor is to be shown or not
|
int |
getSizeHeight()
Gets the level vertical size
|
int |
getSizeWidth()
Gets the level horizontal size
|
int |
incrementCursorXPosition()
Increaments the cursor position X value
|
int |
incrementCursorYPosition()
Increaments the cursor position Y value
|
void |
incrementScore()
Increments the user score
|
boolean |
isGameRunning()
tells if the game is running
|
boolean |
isRockfordInModel()
Return whether rockford is in model or not
Notice: not optimized, be careful
|
void |
makeThisBoulderSlideLeft(int x,
int y)
Makes the BoulderModel[x][y] slide left
|
void |
makeThisBoulderSlideRight(int x,
int y)
Makes the BoulderModel[x][y] slide right
|
void |
makeThisDisplayableElementFall(int x,
int y)
Makes the DisplayableElement[x][y] fall one box down
|
void |
moveThisBoulderToLeft(int x,
int y)
Makes the BoulderModel[x][y] moving to left
|
void |
moveThisBoulderToRight(int x,
int y)
Makes the BoulderModel[x][y] moving to right
|
void |
resetLevelModel() |
void |
run()
Update all the sprites So that they can be animated
|
void |
setGamePaused(boolean gamePaused)
Set the gamePaused variable
|
void |
setGameRunning(boolean gameRunning)
sets the game to a defined state
|
void |
setMode(java.lang.String mode)
Set the mode where this levelModel is used
|
void |
setPositionOfRockford(int posX,
int posY)
Sets the new Rockford position
|
void |
setShowCursor(boolean showCursor)
Sets whether cursor is to be shown or not
|
void |
setSizeHeight(int sizeHeight)
Sets the level vertical size
|
void |
setSizeWidth(int sizeWidth)
Sets the level horizontal size
|
void |
transformThisBoulderIntoADiamond(int x,
int y)
Makes the BoulderModel[x][y] transform into a diamond
|
void |
triggerBlockChange(java.lang.String blockValue)
Trigger block change with provided value
|
void |
updateRockfordPosition(int posX,
int posY)
Updates the horizontal & vertical positions of Rockford in the model
|
void |
updateSprites(int x,
int y)
Update the current sprite Notifies the observers
|
public LevelModel(java.lang.String levelName, AudioLoadHelper audioLoadHelper, java.lang.String mode)
levelName
- Level nameaudioLoadHelper
- Audio load helpermode
- Instance modepublic LevelModel(java.lang.String levelName, AudioLoadHelper audioLoadHelper)
levelName
- Level nameaudioLoadHelper
- Audio load helperpublic LevelModel(AudioLoadHelper audioLoadHelper)
audioLoadHelper
- Audio load helperpublic void resetLevelModel()
public void updateRockfordPosition(int posX, int posY)
posX
- Horizontal position of RockfordposY
- Vertical position of Rockfordpublic int getRockfordPositionX()
public void setPositionOfRockford(int posX, int posY)
posX
- Next horizontal position on the gridposY
- Next vertical position on the gridpublic void triggerBlockChange(java.lang.String blockValue)
blockValue
- New valuepublic int getRockfordPositionY()
public RockfordModel getRockford()
public DisplayableElementModel getDisplayableElement(int x, int y)
x
- Block horizontal positiony
- Block vertical positionpublic java.awt.image.BufferedImage getImage(int x, int y)
x
- Block horizontal positiony
- Block vertical positionpublic java.awt.image.BufferedImage getCursorImage()
public boolean isRockfordInModel()
public int countDiamonds()
public void checkConstraints() throws LevelConstraintNotRespectedException
public int getSizeWidth()
public void setSizeWidth(int sizeWidth)
sizeWidth
- Horizontal sizepublic int getSizeHeight()
public void setSizeHeight(int sizeHeight)
public DisplayableElementModel[][] getGroundLevelModel()
public void updateSprites(int x, int y)
x
- Sprite block horizontal positiony
- Sprite block vertical positionpublic void run()
run
in interface java.lang.Runnable
public void incrementScore()
public LevelLoadHelper getLevelLoadHelper()
public int getCursorXPosition()
public int getCursorYPosition()
public int incrementCursorXPosition()
public int decrementCursorXPosition()
public int incrementCursorYPosition()
public int decrementCursorYPosition()
public void setGameRunning(boolean gameRunning)
gameRunning
- Whether game is running or notpublic boolean isGameRunning()
public boolean getShowCursor()
public void setShowCursor(boolean showCursor)
showCursor
- whether cursor needs to be shown or notpublic void exploseGround(int x, int y)
x
- Object horizontal positiony
- Object vertical positionpublic void makeThisDisplayableElementFall(int x, int y)
x
- Object horizontal positiony
- Object vertical positionpublic void makeThisBoulderSlideLeft(int x, int y)
x
- Object horizontal positiony
- Object vertical positionpublic void makeThisBoulderSlideRight(int x, int y)
x
- Object horizontal positiony
- Object vertical positionpublic void transformThisBoulderIntoADiamond(int x, int y)
x
- Object horizontal positiony
- Object vertical positionpublic void moveThisBoulderToRight(int x, int y)
x
- Object horizontal positiony
- Object vertical positionpublic void moveThisBoulderToLeft(int x, int y)
x
- Object horizontal positiony
- Object vertical positionpublic void deleteThisBoulder(int x, int y)
x
- Object horizontal positiony
- Object vertical positionpublic GameInformationModel getGameInformationModel()
public void exploseThisBrickWall(int x, int y)
x
- y
- public void expandThisWallToLeft(int x, int y)
x
- y
- public void expandThisWallToRight(int x, int y)
x
- y
- public void setGamePaused(boolean gamePaused)
gamePaused
- public boolean getGamePaused()
public java.lang.String getMode()
public void setMode(java.lang.String mode)
mode
-