Skip to content

Commit

Permalink
Updated TowerType() which "basic" descriptions of each turret which i…
Browse files Browse the repository at this point in the history
…s then displayed under each image
  • Loading branch information
fattyhope committed Sep 11, 2023
1 parent 0af0866 commit 0b81be6
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 14 deletions.
36 changes: 22 additions & 14 deletions source/core/src/main/com/csse3200/game/screens/TowerType.java
Original file line number Diff line number Diff line change
@@ -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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit 0b81be6

Please sign in to comment.