Class TerrainFactory

java.lang.Object
com.csse3200.game.areas.terrain.TerrainFactory

public class TerrainFactory extends Object
Factory for creating game terrains.
  • Constructor Details

    • TerrainFactory

      public TerrainFactory(CameraComponent cameraComponent)
      Create a terrain factory with Orthogonal orientation
      Parameters:
      cameraComponent - Camera to render terrains to. Must be ortographic.
    • TerrainFactory

      public TerrainFactory(CameraComponent cameraComponent, TerrainComponent.TerrainOrientation orientation)
      Create a terrain factory
      Parameters:
      cameraComponent - Camera to render terrains to. Must be orthographic.
      orientation - orientation to render terrain at
  • Method Details

    • createTerrain

      public TerrainComponent createTerrain(TerrainFactory.TerrainType terrainType)
      Create a terrain of the given type, using the orientation of the factory. This can be extended to add additional game terrains.
      Parameters:
      terrainType - Terrain to create
      Returns:
      Terrain component which renders the terrain
    • createRenderer

      public com.badlogic.gdx.maps.tiled.TiledMapRenderer createRenderer(com.badlogic.gdx.maps.tiled.TiledMap tiledMap, float tileScale)
      Creates and returns a renderer for the provided tiled map and scale.
      Parameters:
      tiledMap - The tiled map for which the renderer is created.
      tileScale - The scale factor for the tiles.
      Returns:
      A TiledMapRenderer instance suitable for the given map and scale.