Team 3 ‐ UX UI - UQcsse3200/2026-studio-3 GitHub Wiki
Overview
Combat Background Framework
The framework displays a configurable static image behind combatants. Backgrounds are defined in JSON and selected by ID, allowing new artwork to be added without changing rendering code.
Main components
| Component | Purpose |
|---|---|
CombatBackgroundConfig |
Stores a background's ID, name, and texture path. |
CombatBackgroundConfigs |
Finds configurations by ID. |
CombatBackgroundComponent |
Draws the image to fill the camera view without stretching. |
ForestGameArea |
Validates the selection, loads the texture, spawns the background, and handles cleanup. |
Adding and selecting backgrounds
Place the image in source/core/assets/images and add an entry to source/core/assets/configs/backgrounds.json:
{
"backgrounds": [
{
"id": "forest",
"name": "Forest",
"texture": "images/grass_1.png"
}
]
}
Each entry needs a unique, case-sensitive ID, a nonblank name, and an existing texture path relative to source/core/assets.
Select the background when creating the area:
ForestGameArea gameArea =
new ForestGameArea(terrainFactory, mapProgression, "forest");
gameArea.create();
Omit the ID or pass null to use the original terrain. The documented BattleScreen currently passes null.
Behaviour
- The image follows an unrotated orthographic camera and scales with its viewport and zoom. Its aspect ratio is preserved, with excess content cropped.
- It renders above terrain and behind combatants using layer
0and Z index1f. Terrain and collision walls remain underneath. - Missing or invalid configurations and missing texture files leave the original terrain visible. Asset decoding failures are not generally handled by this fallback.
ForestGameArealoads and unloads textures throughResourceService; the rendering component does not dispose of them.- One static background is selected at area creation. Animation, parallax, and runtime switching are not implemented.
Testing
CombatBackgroundConfigsTest covers matching IDs, unknown IDs, null IDs, and empty collections. Manually check image scaling, rendering order, fallback behaviour, and leaving/reopening battles.
Based on task/background-framework, commit a702bee.
player stats icons references
- money/gold icon: https://lovelyov.click/product_details/13883108.html
- piety/level icon: https://www.flaticon.com/free-icon/trophy_1683698
- energy icon: https://uxwing.com/lightning-icon/
player image reference
- player image from: @mariadeniseanda
enemy stats icon references
- armour icon: https://dinopixel.com/iron-armor-pixel-art-25532