-
Notifications
You must be signed in to change notification settings - Fork 7
Game Areas
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.
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
.
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();