Skip to content

Terrain

polyrain edited this page Aug 1, 2021 · 1 revision

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 the TerrainFactory 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. The TerrainFactory 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 of TerrainFactory. This will likely be somewhere in the GameArea.
  • 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.

Table of Contents

Home

Introduction

Main Menu

Main Game Screen

Gameplay

Player Movement

Character Animations

Enemy Monster Design and Animations

Game basic functionalities

User Testing

GitHub Wiki Tutorial

Game Engine

Getting Started

Documentation

Entities and Components

Service Locator

Loading Resources

Logging

Unit Testing

Debug Terminal

Input Handling

UI

Animations

Audio

AI

Physics

Game Screens and Areas

Terrain

Concurrency & Threading

Settings

Troubleshooting

MacOS Setup Guide

Clone this wiki locally