Package playground
Class BreakoutLevel1
java.lang.Object
playground.Playground
playground.BreakoutLevelBase
playground.BreakoutLevel1
Class that generates a level with one egoObject, ball and ten bricks which need to be destroyed with the ball.
-
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) This method defines the behavior when the ball hits a brick.protected void
actionIfBallHitsEgo
(GameObject ball, GameObject ego) This method defines the behavior when the ball hits the EgoObject.protected GameObject
This method creates a new ball.protected GameObject
createBrick
(int row, int column) This method creates a new brick.protected GameObject
This method creates a new RectObject.void
prepareLevel
(String level) This method creates 3 rows and 10 columns with bricks.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
-
BreakoutLevel1
public BreakoutLevel1()
-
-
Method Details
-
actionIfBallHitsBrick
This method defines the behavior when the ball hits a brick. It allows the ball to destroy the brick and move on in opposite direction.- Specified by:
actionIfBallHitsBrick
in classBreakoutLevelBase
- Parameters:
ball
- GameObject the one ball of the game.brick
- GameObject the brick that is hit.
-
actionIfBallHitsEgo
This method defines the behavior when the ball hits the EgoObject.- Specified by:
actionIfBallHitsEgo
in classBreakoutLevelBase
- Parameters:
ball
- GameObject the one ball in the game.ego
- GameObject the object the player controls.
-
createEgoObject
This method creates a new RectObject.- Specified by:
createEgoObject
in classBreakoutLevelBase
- Returns:
- ego object.
-
createBall
This method creates a new ball.- Specified by:
createBall
in classBreakoutLevelBase
- Returns:
- ball
-
createBrick
This method creates a new brick.- Specified by:
createBrick
in classBreakoutLevelBase
- Parameters:
row
- int row for position of the brick.column
- int column for the position of the brick.- Returns:
- brick.
-
prepareLevel
This method creates 3 rows and 10 columns with bricks. It also adds objects of ball and ego to Playground.- Specified by:
prepareLevel
in classBreakoutLevelBase
- Parameters:
level
- String passes by the game engine (not used currently and can be ignored).
-