Skip to content

Terrain

acoox edited this page May 24, 2021 · 5 revisions

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

How to Play

Introduction

Game Features

Main Character

Enemies
The Final Boss

Landscape Objects

Shop
Inventory
Achievements
Camera

Crystal

Infrastructure

Audio

User Interfaces Across All Pages
Juicy UI
User Interfaces Buildings
Guidebook
[Resource Management](Resource-Management)
Map
Day and Night Cycle
Unified Grid System (UGS)
Polishing

Game Engine

Getting Started

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