Class SokobanBoard

All Implemented Interfaces:
TurnListener, Killer, AvailabilityChecker, Cloneable, Iterable<String>, Serializable

public class SokobanBoard extends AreaEntity implements TurnListener, AvailabilityChecker
A sokoban board
Author:
hendrik
  • Constructor Details

    • SokobanBoard

      public SokobanBoard(SokobanListener sokobanListener)
      creates a SokobanBoard
      Parameters:
      sokobanListener - SokobanListener
  • Method Details

    • loadLevel

      public void loadLevel(int lvl)
      loads a level
      Parameters:
      lvl - level number
    • clear

      public void clear()
      removes all created entities (walls, boxes, containers)
    • setPlayer

      public void setPlayer(Player player)
      sets the currently playing player
      Parameters:
      player - player
    • getLevelCount

      public int getLevelCount()
      gets the number of levels
      Returns:
      number of levels
    • isGameActive

      public boolean isGameActive()
      checks whether a game is active.
      Returns:
      true, if a game is active, false otherwise
    • isPlayerPresent

      public boolean isPlayerPresent()
      checks whether the player is present
      Returns:
      true, if the player is inside the game field; false otherwise
    • onTurnReached

      public void onTurnReached(int currentTurn)
      Description copied from interface: TurnListener
      This method is called when the turn number is reached.
      Specified by:
      onTurnReached in interface TurnListener
      Parameters:
      currentTurn - current turn number
    • isAvailable

      public boolean isAvailable()
      Description copied from interface: AvailabilityChecker
      is this resource available?
      Specified by:
      isAvailable in interface AvailabilityChecker
      Returns:
      true, if the resource is available; false otherwise