Skip to content

Game Areas

polyrain edited this page Aug 1, 2021 · 1 revision

Introduction

Game areas are areas within the game that have their own terrain, entities and UI. The aim of game areas is to make it easy to create different levels and areas within the same game screen.

The Forest Game Area within the Main Game Screen is an example of a game area.

Resource Management

Assets can be loaded/unloaded at both the screen and game area levels.

In the example game there is only one game area, however, it is very straight forward to add a new game area. This is an example of what it would look like if we added a new (made-up) game area called Forest2GameArea.

There are going to be some assets that are relevant to all game areas within the screen, e.g. the exit button on the Main Game screen. These would be loaded in the screen using the Resource Service.

Whereas assets that are only needed for a single game area, e.g. the Game Area Display which displays the game area's name, can be loaded by the game area using the Resource Service.

This is what asset loading and unloading would look like for a screen which started with a ForestGameArea then transition to a Forest2GameArea.

Usage

Initialising and Moving Between Game Areas

Intialise a game area within the screen:

TerrainFactory terrainFactory = new TerrainFactory(renderer.getCamera());

ForestGameArea forestGameArea = new ForestGameArea(terrainFactory);
forestGameArea.create();

Transition to a new game area within the same screen:

forestGameArea.dispose();
ForestGameArea2 forestGameArea2 = new ForestGameArea2(terrainFactory);
forestGameArea2.create();

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