Package playground

Class BreakoutLevel2


public class BreakoutLevel2 extends BreakoutLevelBaseAdvanced
  • 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 class BreakoutLevelBaseAdvanced
      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 class BreakoutLevelBaseAdvanced
      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 class BreakoutLevelBaseAdvanced
      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 class BreakoutLevelBaseAdvanced
      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 class BreakoutLevelBaseAdvanced
      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 class BreakoutLevelBaseAdvanced
      Returns:
      positive value of the Y coordinate to use as the starting point of the upper left corner of the brick set.
    • actionIfBallHitsBrick

      protected void actionIfBallHitsBrick(GameObject ball, GameObject brick)
      Description copied from class: BreakoutLevelBase
      Method that gets called by applyGameLogic() whenever the ball collides with a brick.
      Specified by:
      actionIfBallHitsBrick in class BreakoutLevelBase
      Parameters:
      ball - A reference to the current ball object
      brick - A reference to the ego object
    • actionIfBallHitsEgo

      protected void actionIfBallHitsEgo(GameObject ball, GameObject ego)
      Description copied from class: BreakoutLevelBase
      Method that gets called by applyGameLogic() whenever the ball collides with the ego object.
      Specified by:
      actionIfBallHitsEgo in class BreakoutLevelBase
      Parameters:
      ball - A reference to the current ball object
      ego - A reference to the ego object
    • createEgoObject

      protected GameObject createEgoObject()
      Description copied from class: BreakoutLevelBase
      Creates the ego object and returns it, called by BreakoutLevelBase.prepareLevel(java.lang.String). Does NOT add the ego object to the playground, but returns it.
      Specified by:
      createEgoObject in class BreakoutLevelBase
      Returns:
      The created ego object instance (of class RectObject with EgoController.
    • createBall

      protected GameObject 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 class BreakoutLevelBase
      Returns:
      The created ball object instance (of class FallingStar)
    • createBrick

      protected GameObject createBrick(int row, int column)
      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 class BreakoutLevelBase
      Parameters:
      row - row position in the grid, ranges from 0 to calcNrBricksY()-1
      column - column position in the grid of bricks, ranges from 0 to calcNrBricksX()-1
      Returns:
      The GameObject instance (really a RectObject) representing the created brick.