Package com.deco2800.game.areas.terrain
Class TerrainComponent
java.lang.Object
com.deco2800.game.components.Component
com.deco2800.game.rendering.RenderComponent
com.deco2800.game.areas.terrain.TerrainComponent
- All Implemented Interfaces:
 Disposable,Renderable,java.lang.Comparable<Renderable>
public class TerrainComponent extends RenderComponent
Render a tiled terrain for a given tiled map and orientation. A terrain is a map of tiles that
 shows the 'ground' in the game. Enabling/disabling this component will show/hide the terrain.
- 
Nested Class Summary
Nested Classes Modifier and Type Class Description static classTerrainComponent.TerrainOrientation - 
Field Summary
 - 
Constructor Summary
Constructors Constructor Description TerrainComponent(OrthographicCamera camera, TiledMap map, TiledMapRenderer renderer, TerrainComponent.TerrainOrientation orientation, float tileSize) - 
Method Summary
Modifier and Type Method Description voiddispose()Called when the component is disposed.voiddraw(SpriteBatch batch)Draw the renderable.intgetLayer()Layer to be rendered in.TiledMapgetMap()GridPoint2getMapBounds(int layer)floatgetTileSize()floatgetZIndex()Set the zIndex of the entity according to the y coordinate of the entity and the original zIndex.Vector2tileToWorldPosition(int x, int y)Vector2tileToWorldPosition(GridPoint2 tilePos)Methods inherited from class com.deco2800.game.components.Component
earlyUpdate, getEntity, setEnabled, setEntity, toString, triggerEarlyUpdate, triggerUpdate, update 
- 
Constructor Details
- 
TerrainComponent
public TerrainComponent(OrthographicCamera camera, TiledMap map, TiledMapRenderer renderer, TerrainComponent.TerrainOrientation orientation, float tileSize) 
 - 
 - 
Method Details
- 
tileToWorldPosition
 - 
tileToWorldPosition
 - 
getTileSize
public float getTileSize() - 
getMapBounds
 - 
getMap
 - 
draw
Description copied from class:RenderComponentDraw the renderable. Should be called only by the renderer, not manually.- Specified by:
 drawin classRenderComponent- Parameters:
 batch- Batch to render to.
 - 
dispose
public void dispose()Description copied from class:ComponentCalled when the component is disposed. Dispose of any internal resources here.- Specified by:
 disposein interfaceDisposable- Overrides:
 disposein classRenderComponent
 - 
getZIndex
public float getZIndex()Description copied from class:RenderComponentSet the zIndex of the entity according to the y coordinate of the entity and the original zIndex. If zIndex is not set originally, then The smaller the Y value, the higher the Z index, so that closer entities are drawn in front. If zIndex has been set, zIndex will not change.- Specified by:
 getZIndexin interfaceRenderable- Overrides:
 getZIndexin classRenderComponent- Returns:
 - The drawing priority of the current entity
 
 - 
getLayer
public int getLayer()Description copied from interface:RenderableLayer to be rendered in. Higher layers will be rendered on top of lower layers.- Specified by:
 getLayerin interfaceRenderable- Overrides:
 getLayerin classRenderComponent- Returns:
 - layer
 
 
 -