Package playground
Class BreakoutLevel2
java.lang.Object
playground.Playground
playground.BreakoutLevelBase
playground.BreakoutLevelBaseAdvanced
playground.BreakoutLevel2
-
Field Summary
Fields inherited from class playground.BreakoutLevelBase
ball, ego
Fields inherited from class playground.Playground
addables, canvasX, canvasY, flags, FLAGS_ALL, FLAGS_GLOBAL, FLAGS_LEVEL, gameObjects, gameTime, keyEvents, level, mouseEvents, pausedFlag, removables, timeStep
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
actionIfBallHitsBrick
(GameObject ball, GameObject brick) Method that gets called by applyGameLogic() whenever the ball collides with a brick.protected void
actionIfBallHitsEgo
(GameObject ball, GameObject ego) Method that gets called by applyGameLogic() whenever the ball collides with the ego object.protected int
provides the number of bricks to be set in horizontal direction.protected int
provides the number of bricks to be set in vertical direction.protected GameObject
Creates the ball object and returns it, called by #prepareLevel.protected GameObject
createBrick
(int row, int column) Creates the GameObject (RectObject) instance representing a single brick at a certain grid position.protected GameObject
Creates the ego object and returns it, called byBreakoutLevelBase.prepareLevel(java.lang.String)
.protected double
provides the length of one brick.protected double
provides the height of one brick.protected double
provides the start coordinate of upper left corner (X value).protected double
provides the start coordinate of upper left corner (Y value).Methods inherited from class playground.BreakoutLevelBaseAdvanced
prepareLevel
Methods inherited from class playground.BreakoutLevelBase
applyGameLogic, gameOver, levelFinished, preferredSizeX, preferredSizeY, redrawLevel, resetRequested
Methods inherited from class playground.Playground
addObject, addObjectNow, collectObjects, deleteObject, deleteObjectNow, getGameTime, getGlobalFlag, getKeyEvents, getLevelFlag, getMouseEvents, getObject, getOrCreateGlobalFlag, getOrCreateLevelFlag, getSizeX, getSizeY, getTimestep, isPaused, processKeyEvents, processMouseEvents, redraw, reset, resetFlags, setGameTime, setGlobalFlag, setLevelFlag, setPaused, setTimestep, togglePause, updateObjects
-
Constructor Details
-
BreakoutLevel2
public BreakoutLevel2()
-
-
Method Details
-
calcNrBricksX
protected int calcNrBricksX()Description copied from class:BreakoutLevelBaseAdvanced
provides the number of bricks to be set in horizontal direction.- Specified by:
calcNrBricksX
in classBreakoutLevelBaseAdvanced
- Returns:
- positive value of how many bricks are to be next to each other in X direction
-
calcNrBricksY
protected int calcNrBricksY()Description copied from class:BreakoutLevelBaseAdvanced
provides the number of bricks to be set in vertical direction.- Specified by:
calcNrBricksY
in classBreakoutLevelBaseAdvanced
- Returns:
- positive value of how many bricks are to be next to each other in Y direction
-
getBrickSizeX
protected double getBrickSizeX()Description copied from class:BreakoutLevelBaseAdvanced
provides the length of one brick.- Specified by:
getBrickSizeX
in classBreakoutLevelBaseAdvanced
- Returns:
- positive value of how long a brick should be in X direction.
-
getBrickSizeY
protected double getBrickSizeY()Description copied from class:BreakoutLevelBaseAdvanced
provides the height of one brick.- Specified by:
getBrickSizeY
in classBreakoutLevelBaseAdvanced
- Returns:
- positive value of how high a brick should be in Y direction.
-
getBrickStartX
protected double getBrickStartX()Description copied from class:BreakoutLevelBaseAdvanced
provides the start coordinate of upper left corner (X value).- Specified by:
getBrickStartX
in classBreakoutLevelBaseAdvanced
- Returns:
- positive value of the X coordinate to use as the starting point of the upper left corner of the brick set.
-
getBrickStartY
protected double getBrickStartY()Description copied from class:BreakoutLevelBaseAdvanced
provides the start coordinate of upper left corner (Y value).- Specified by:
getBrickStartY
in classBreakoutLevelBaseAdvanced
- Returns:
- positive value of the Y coordinate to use as the starting point of the upper left corner of the brick set.
-
actionIfBallHitsBrick
Description copied from class:BreakoutLevelBase
Method that gets called by applyGameLogic() whenever the ball collides with a brick.- Specified by:
actionIfBallHitsBrick
in classBreakoutLevelBase
- Parameters:
ball
- A reference to the current ball objectbrick
- A reference to the ego object
-
actionIfBallHitsEgo
Description copied from class:BreakoutLevelBase
Method that gets called by applyGameLogic() whenever the ball collides with the ego object.- Specified by:
actionIfBallHitsEgo
in classBreakoutLevelBase
- Parameters:
ball
- A reference to the current ball objectego
- A reference to the ego object
-
createEgoObject
Description copied from class:BreakoutLevelBase
Creates the ego object and returns it, called byBreakoutLevelBase.prepareLevel(java.lang.String)
. Does NOT add the ego object to the playground, but returns it.- Specified by:
createEgoObject
in classBreakoutLevelBase
- Returns:
- The created ego object instance (of class
RectObject
withEgoController
.
-
createBall
Description copied from class:BreakoutLevelBase
Creates the ball object and returns it, called by #prepareLevel. Does NOT add the ball object to the playground, but returns it.- Specified by:
createBall
in classBreakoutLevelBase
- Returns:
- The created ball object instance (of class
FallingStar
)
-
createBrick
Description copied from class:BreakoutLevelBase
Creates the GameObject (RectObject) instance representing a single brick at a certain grid position. The brick is NOT added here, but returned.- Specified by:
createBrick
in classBreakoutLevelBase
- Parameters:
row
- row position in the grid, ranges from 0 to calcNrBricksY()-1column
- column position in the grid of bricks, ranges from 0 to calcNrBricksX()-1- Returns:
- The GameObject instance (really a RectObject) representing the created brick.
-