-
Notifications
You must be signed in to change notification settings - Fork 7
TerrainTile Class
The map is made up of TerrainTiles. Each TerrainTile
represents a single tile on the map. The TerrainTile
class was a pre-existing class which was included in the base game engine. It has been modified to include several new properties/class variables that represent the TerrainTile
's state as well as new methods that can be used by the map entity to retrieve/modify its state.
The TerrainTile
class has the following class variables along with their associated class methods for modifying/retrieving these values. All of the methods and class variables are defined in the javadocs.
This variable is used to store the terrain type of the tile as defined by the public enum TerrainCategory
included in the TerrainTile
class. The terrainCategory
value that a TerrainTile
has is used to determine the values of some of the other class variables upon instantiation. It also determines the sprite used to represent the TerrainTile in the game area. There are two methods associated with the terrainCategory
class variable, getTerrainCategory
and setTerrainCategory
which both retrieve and set the variable value respectively.
This class variable is used to store whether a TerrainTile
is traversable by any player/NPC entity. It is defined during the TerrainTile
initialization based on the terrainCategory
value. There is only one method associated with the isTraversable
class variable and it is the isTraversable
which returns the variable value.
This class variable is used to store whether there is a stationary entity (such as a crop tile) that is located in the same grid position as the TerrainTile
. Note that this variable is only a boolean
and does not store or reference the entity which is located at the same position if the tile is occupied. There are three methods associated with this class variable, isOccupied
, setOccupied
, and setUnOccupied
which return the value of the variable, set it to true and set it to false respectively.
This class variable is used to store whether a tile is tillable or not (can be used to plant crops). This is also defined during the TerrainTile
initialization based on the terrainCategory
value. It has one associated method, isTillable
, which returns the variable value.
This class variable is used to store a cropTile
entity which occupies the terrainTile
. Is set to null
when the class is initialised. There are three methods associated with this class variable, getCropTile
, setCropTile
and removeCropTile
which returns the cropTile
that occupies the terrainTile
, sets the cropTile
which occupies the terrainTile
and removes the cropTile
which occupies the terrainTile
respectively.
This class variable is used to store a float speedModifier for entities moving on top of it. It is intended to act as a multiplier for an entities default movement on the TerrainTile
. It is set during the initialization of the TerrainTile
class. There is one method associated with this class variable, getSpeedModifier
which returns the value of speedModifier
.
These sprites are supposed to display an 'Alien' planet's terrain so not all sprites will look exactly like earth terrain with different colours such as purple being used extensively.