Package playground

Class BreakoutLevel1


public class BreakoutLevel1 extends BreakoutLevelBase
Class that generates a level with one egoObject, ball and ten bricks which need to be destroyed with the ball.
  • Constructor Details

    • BreakoutLevel1

      public BreakoutLevel1()
  • Method Details

    • actionIfBallHitsBrick

      protected void actionIfBallHitsBrick(GameObject ball, GameObject brick)
      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 class BreakoutLevelBase
      Parameters:
      ball - GameObject the one ball of the game.
      brick - GameObject the brick that is hit.
    • actionIfBallHitsEgo

      protected void actionIfBallHitsEgo(GameObject ball, GameObject ego)
      This method defines the behavior when the ball hits the EgoObject.
      Specified by:
      actionIfBallHitsEgo in class BreakoutLevelBase
      Parameters:
      ball - GameObject the one ball in the game.
      ego - GameObject the object the player controls.
    • createEgoObject

      protected GameObject createEgoObject()
      This method creates a new RectObject.
      Specified by:
      createEgoObject in class BreakoutLevelBase
      Returns:
      ego object.
    • createBall

      protected GameObject createBall()
      This method creates a new ball.
      Specified by:
      createBall in class BreakoutLevelBase
      Returns:
      ball
    • createBrick

      protected GameObject createBrick(int row, int column)
      This method creates a new brick.
      Specified by:
      createBrick in class BreakoutLevelBase
      Parameters:
      row - int row for position of the brick.
      column - int column for the position of the brick.
      Returns:
      brick.
    • prepareLevel

      public void prepareLevel(String level)
      This method creates 3 rows and 10 columns with bricks. It also adds objects of ball and ego to Playground.
      Specified by:
      prepareLevel in class BreakoutLevelBase
      Parameters:
      level - String passes by the game engine (not used currently and can be ignored).