From 0b81be6c0b263def0291aa97e70fa405cf3bb82c Mon Sep 17 00:00:00 2001 From: FattyHope Date: Tue, 12 Sep 2023 00:58:54 +1000 Subject: [PATCH] Updated TowerType() which "basic" descriptions of each turret which is then displayed under each image --- .../com/csse3200/game/screens/TowerType.java | 36 +++++++++++-------- .../game/screens/TurretSelectionScreen.java | 7 ++++ 2 files changed, 29 insertions(+), 14 deletions(-) diff --git a/source/core/src/main/com/csse3200/game/screens/TowerType.java b/source/core/src/main/com/csse3200/game/screens/TowerType.java index deed94733..1dd3eadf5 100644 --- a/source/core/src/main/com/csse3200/game/screens/TowerType.java +++ b/source/core/src/main/com/csse3200/game/screens/TowerType.java @@ -1,27 +1,35 @@ package com.csse3200.game.screens; public enum TowerType { - WEAPON("images/towers/turret_deployed.png", "Weapon Tower"), - TNT("images/towers/turret_deployed.png", "TNT Tower"), - DROID("images/towers/turret_deployed.png", "Droid Tower"), - WALL("images/towers/turret_deployed.png", "Wall Tower"), - FIRE("images/towers/turret_deployed.png", "Fire Tower"), - STUN("images/towers/turret_deployed.png", "Stun Tower"), - INCOME("images/towers/turret_deployed.png", "Income Tower"); + WEAPON("images/towers/turret_deployed.png", "Weapon Tower", + "The Weapon Tower is a simple and basic turret that fires rapid shots at enemies dealing damage over time."), + TNT("images/towers/turret_deployed.png", "TNT Tower", + "The TNT Tower launches explosive projectiles, dealing area damage to groups of enemies."), + DROID("images/towers/turret_deployed.png", "Droid Tower", + "Droid Towers deploy robotic helpers that assist in combat and provide support to nearby turrets."), + WALL("images/towers/turret_deployed.png", "Wall Tower", + "The Wall Tower creates barriers to block enemy paths, slowing down their progress."), + FIRE("images/towers/turret_deployed.png", "Fire Tower", + "The Fire Tower emits flames, causing damage over time to enemies caught in its fiery radius."), + STUN("images/towers/turret_deployed.png", "Stun Tower", + "The Stun Tower releases electric shocks that temporarily immobilize and damage enemies."), + INCOME("images/towers/turret_deployed.png", "Income Tower", + "The Income Tower generates additional in-game currency over time."); private final String imagePath; private final String towerName; + private final String description; - TowerType(String imagePath, String towerName) { + TowerType(String imagePath, String towerName, String description) { this.imagePath = imagePath; this.towerName = towerName; + this.description = description; } - public String getImagePath() { - return imagePath; - } + public String getImagePath() { return imagePath; } + + public String getTowerName() { return towerName; } + + public String getDescription() { return description; } - public String getTowerName() { - return towerName; - } } diff --git a/source/core/src/main/com/csse3200/game/screens/TurretSelectionScreen.java b/source/core/src/main/com/csse3200/game/screens/TurretSelectionScreen.java index ff078fc6f..bb2a8a88a 100644 --- a/source/core/src/main/com/csse3200/game/screens/TurretSelectionScreen.java +++ b/source/core/src/main/com/csse3200/game/screens/TurretSelectionScreen.java @@ -105,6 +105,13 @@ public void clicked(InputEvent event, float x, float y) { // Add the image to the nested table turretTable.add(turretImage).pad(10).row(); + // Create a label for the turret description + Label turretDescriptionLabel = new Label(turret.getDescription(), skin); + turretDescriptionLabel.setWrap(true); // Wrap text if it's too long + + // Add the description label to the nested table + turretTable.add(turretDescriptionLabel).center().width(200).pad(10).row(); // Adjust width if needed + // Create a TextButton for the turret name TextButton turretButton = new TextButton(turret.getTowerName(), skin); turretButton.addListener(new ClickListener() {