Class MapLayout

java.lang.Object
com.csse3200.game.services.MapLayout

public class MapLayout extends Object
Class to load the map layout from a text file
  • Constructor Details

    • MapLayout

      public MapLayout()
      Constructor for the MapLayout class
  • Method Details

    • getEvents

      public EventHandler getEvents()
    • load

      public Map load(GdxGame.LevelType level)
      Load the map layout from a text file Yab -> spawn vertical bench starting at column `a` that is `b` cells long Xab -> spawn horizontal bench starting at column `a` that is `b` cells long []a -> for any station, spawns a station based on [] at column `a` the row of the object depends on what line it's on in the file.
      Parameters:
      level - - integer 1-5 corresponding to level
    • parseLine

      public ArrayList<Bench> parseLine(String[] parts, int row, int col)
      parses a line from the map file
      Parameters:
      parts - - the string to parse
      row - - the row of the line
      col - - the column index
      Returns:
      the list of benches
    • readStation

      public Entity readStation(String type, int col, int row)
      Read a station from the map file
      Parameters:
      type - - the type of station
      col - - the column of the station
      row - - the row of the station
      Returns:
      - an Entity object
    • validateStation

      public boolean validateStation(String str)
      Validate a station
      Parameters:
      str - - the station to validate
      Returns:
      - a boolean indicating if the station is valid
    • getMapName

      public String getMapName()
      Get the map name
      Returns:
      - the map name
    • getMapWidth

      public int getMapWidth()
      Get the map width
      Returns:
      - the map width
    • getMapHeight

      public int getMapHeight()
      Get the map height
      Returns:
      - the map height