Package playground

Class BreakoutLevelBaseAdvanced

Direct Known Subclasses:
BreakoutLevel2

public abstract class BreakoutLevelBaseAdvanced extends BreakoutLevelBase
Advanced version of abstract BreakoutLevelBase providing a complete implementation of prepareLevel(String). Additionally abstract methods for number of bricks in X and Y direction are provided as well as abstract methods for brick sizes and start coordinates.
See Also:
  • Constructor Details

    • BreakoutLevelBaseAdvanced

      public BreakoutLevelBaseAdvanced()
  • Method Details

    • calcNrBricksX

      protected abstract int calcNrBricksX()
      provides the number of bricks to be set in horizontal direction.
      Returns:
      positive value of how many bricks are to be next to each other in X direction
    • calcNrBricksY

      protected abstract int calcNrBricksY()
      provides the number of bricks to be set in vertical direction.
      Returns:
      positive value of how many bricks are to be next to each other in Y direction
    • getBrickSizeX

      protected abstract double getBrickSizeX()
      provides the length of one brick.
      Returns:
      positive value of how long a brick should be in X direction.
    • getBrickSizeY

      protected abstract double getBrickSizeY()
      provides the height of one brick.
      Returns:
      positive value of how high a brick should be in Y direction.
    • getBrickStartX

      protected abstract double getBrickStartX()
      provides the start coordinate of upper left corner (X value).
      Returns:
      positive value of the X coordinate to use as the starting point of the upper left corner of the brick set.
    • getBrickStartY

      protected abstract double getBrickStartY()
      provides the start coordinate of upper left corner (Y value).
      Returns:
      positive value of the Y coordinate to use as the starting point of the upper left corner of the brick set.
    • prepareLevel

      public void prepareLevel(String level)
      Prepares a complete Breakout type level and uses the values provided by implementations of calcNrBricksX() and calcNrBricksY() to generate the stone matrix. Furthermore, it relies on the methods BreakoutLevelBase.createEgoObject(), BreakoutLevelBase.createBall() and BreakoutLevelBase.createBrick(int, int), which are meant to be overwritten in subclasses.
      Attention: For collision detection bricks created by BreakoutLevelBase.createBrick(int, int) need to have the String 'brick' in ID.
      Specified by:
      prepareLevel in class BreakoutLevelBase
      Parameters:
      level - String passes by the game engine (not used currently and can be ignored).
      See Also:
      • for further information.