Skip to content

Commit

Permalink
Change fire rate from text to image
Browse files Browse the repository at this point in the history
  • Loading branch information
fattyhope committed Oct 2, 2023
1 parent 4a9b7a8 commit 0b570a3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Binary file added source/core/assets/images/glass.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,9 @@ public void clicked(InputEvent event, float x, float y) {
Drawable attackIconDrawable = new TextureRegionDrawable(new TextureRegion(new Texture("images/attack.png")));
Image attackIconImage = new Image(attackIconDrawable);

Drawable fireRateDrawable = new TextureRegionDrawable(new TextureRegion(new Texture("images/glass.png")));
Image fireRateImage = new Image(fireRateDrawable);


TextButton upgradeHealth = new TextButton("+H", style);
upgradeHealth.addListener(new ClickListener() {
Expand Down Expand Up @@ -207,7 +210,7 @@ public void clicked(InputEvent event, float x, float y) {
turretEntity.getComponent(TowerUpgraderComponent.class).upgradeTower(TowerUpgraderComponent.UPGRADE.FIRERATE, (int) newFireRate * 5);

float fireRate = turretEntity.getComponent(UpgradableStatsComponent.class).getAttackRate();
fireRateLabel.setText(String.format("Fire Rate: %.2f", fireRate));
fireRateLabel.setText(String.format("%.2f", fireRate));
}
}
});
Expand All @@ -232,10 +235,13 @@ public void clicked(InputEvent event, float x, float y) {
innerUpgradeTable.add(healthIconImage).padRight(5).width(32).height(32); // Add health icon
innerUpgradeTable.add(healthLabel).expandX().left();
innerUpgradeTable.row();

if (attack != 0) {
innerUpgradeTable.add(attackIconImage).padRight(5).width(32).height(32); // Add attack icon
innerUpgradeTable.add(attackLabel).expandX().left();
innerUpgradeTable.row();

innerUpgradeTable.add(fireRateImage).padRight(5).width(32).height(32); // Add fire rate icon
innerUpgradeTable.add(fireRateLabel).expandX().right();
innerUpgradeTable.row();
}
Expand Down

0 comments on commit 0b570a3

Please sign in to comment.