Terrain - UQdeco2800/2022-studio-3 GitHub Wiki
The terrain in the provided example game uses tiles, placed orthogonally. The game includes functionality for creating terrains in different orientations, and converting from tile positions to world-space positions.
Key Components
TerrainComponent
: This component, when attached to an entity, can be used to create and render a terrain. This is generally done through theTerrainFactory
rather than directly instantiating it.TerrainFactory
: Where terrains get created, by choosing the orientation and filling in the tiles. When creating the factory, the desired tile orientation can be chosen. TheTerrainFactory
can then be used to create all the terrains in your game.TerrainTile
: Represents a single tile in the terrain. This can be modified to add features like walking speed, particle effects, and sound effects.
Orientations
Orthogonal
Isometric
Hexagonal
How to change
To change the orientation, you need to:
- Change the
TerrainOrientation
in the constructor ofTerrainFactory
. This will likely be somewhere in theGameArea
. - Update
TerrainFactory.createTerrain()
to use the tile textures you've created for your orientation. In the example game, one terrain of each type is given. Orthogonal tile textures should be square, isometric tile textures should be a 'diamond' shape, and hexagonal tiles should be... hexagonal.