Package com.csse3200.game.services
Class MapLayout
java.lang.Object
com.csse3200.game.services.MapLayout
Class to load the map layout from a text file
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintGet the map heightGet the map nameintGet the map widthload(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.parses a line from the map filereadStation(String type, int col, int row) Read a station from the map filebooleanvalidateStation(String str) Validate a station
-
Constructor Details
-
MapLayout
public MapLayout()Constructor for the MapLayout class
-
-
Method Details
-
getEvents
-
load
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
parses a line from the map file- Parameters:
parts- - the string to parserow- - the row of the linecol- - the column index- Returns:
- the list of benches
-
readStation
Read a station from the map file- Parameters:
type- - the type of stationcol- - the column of the stationrow- - the row of the station- Returns:
- - an Entity object
-
validateStation
Validate a station- Parameters:
str- - the station to validate- Returns:
- - a boolean indicating if the station is valid
-
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
-