Package playground
Class BreakoutLevel3
java.lang.Object
playground.Playground
playground.BreakoutLevelBase
playground.BreakoutLevel0
playground.BreakoutLevel3
-
Field Summary
FieldsFields 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) lets ball bounce in Y direction, deletes brick.void
checks for interactions between GameObjects; notably ball with ego and ball with brick.boolean
gameOver()
signals to game engine that the game has finished by game over. called every game loop. default implementation is always false.void
prepareLevel
(String id) Prepares a Breakout level with a 3 x 3 matrix of blocks on top.Methods inherited from class playground.BreakoutLevel0
actionIfBallHitsEgo, createBall, createBrick, createEgoObject
Methods inherited from class playground.BreakoutLevelBase
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
-
Field Details
-
pointsText
TextObject pointsText -
livesText
TextObject livesText
-
-
Constructor Details
-
BreakoutLevel3
public BreakoutLevel3()
-
-
Method Details
-
prepareLevel
Description copied from class:BreakoutLevel0
Prepares a Breakout level with a 3 x 3 matrix of blocks on top. This method relies on the methods#createEgo
,BreakoutLevel0.createBall()
andBreakoutLevel0.createBrick(int, int)
, among others.- Overrides:
prepareLevel
in classBreakoutLevel0
- Parameters:
id
- String passes by the game engine (not used currently and can be ignored).
-
actionIfBallHitsBrick
Description copied from class:BreakoutLevel0
lets ball bounce in Y direction, deletes brick.- Overrides:
actionIfBallHitsBrick
in classBreakoutLevel0
- Parameters:
ball
- A reference to the current ball objectbrick
- A reference to the ego object
-
applyGameLogic
public void applyGameLogic()Description copied from class:BreakoutLevelBase
checks for interactions between GameObjects; notably ball with ego and ball with brick. In case of detected collisions, it calls eitherBreakoutLevelBase.actionIfBallHitsBrick(GameObject, GameObject)
orBreakoutLevelBase.actionIfBallHitsEgo(GameObject, GameObject)
. Called every game loop.- Overrides:
applyGameLogic
in classBreakoutLevelBase
-
gameOver
public boolean gameOver()Description copied from class:BreakoutLevelBase
signals to game engine that the game has finished by game over. called every game loop. default implementation is always false.- Overrides:
gameOver
in classBreakoutLevelBase
- Returns:
- false
-