Class RoomInterpreter

java.lang.Object
com.mg105.interface_adapters.map.RoomInterpreter
All Implemented Interfaces:
RoomInterpreterInterface

public class RoomInterpreter extends Object implements RoomInterpreterInterface
RoomInterpreter interprets the current room in a format that is easier to draw from.
  • Constructor Details

    • RoomInterpreter

      public RoomInterpreter(@NotNull @NotNull RoomGetterInterface getter)
      Create a new RoomInterpreter that will get its information from getter.
      Parameters:
      getter - the information source for the RoomInterpreter.
  • Method Details

    • getCurrentRoom

      public RoomTileType[][] getCurrentRoom()
      Get the current room as represented in an easier to draw grid.
      Specified by:
      getCurrentRoom in interface RoomInterpreterInterface
      Returns:
      the room as a 2 dimension array of TileType representing the current state of the room. Note that (0, 0) represents the top-left corner and (MapConstants.ROOM_SIZE, MapConstants.ROOM_SIZE) represents the bottom right corner.
    • getPlayer

      @NotNull public @NotNull Point getPlayer()
      Get the current player position in the room.
      Specified by:
      getPlayer in interface RoomInterpreterInterface
      Returns:
      the current player position in the room.
    • getCharacterSprite

      @NotNull public @NotNull String getCharacterSprite()
      Retrieves the sprite String currently associated with the WalkingCharacter.
      Specified by:
      getCharacterSprite in interface RoomInterpreterInterface
      Returns:
      a file name/location as a String for the desired character sprite.