From 17329566ac58760582131dd3fd6f66924473f1fe Mon Sep 17 00:00:00 2001 From: SonjaMcNeilly Date: Tue, 17 Oct 2023 14:22:59 +1000 Subject: [PATCH] Added click sounds to every button and adjusted description text font --- .../game/screens/TurretSelectionScreen.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) 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 39b2be22..a4ed1d1e 100644 --- a/source/core/src/main/com/csse3200/game/screens/TurretSelectionScreen.java +++ b/source/core/src/main/com/csse3200/game/screens/TurretSelectionScreen.java @@ -104,18 +104,19 @@ public TurretSelectionScreen(GdxGame game) { backButton.addListener(new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { + click.play(0.4f); // Handle the "back" action, e.g., return to the previous screen game.setScreen(GdxGame.ScreenType.LEVEL_SELECT); // Replace PREVIOUS_SCREEN with the appropriate screen type } }); - stage.addActor(backButton); - message = new Label("Select up to 5 turrets", skin); + message = new Label("Select up to 5 towers", skin); confirmButton = ButtonFactory.createButton("Continue"); confirmButton.addListener(new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { + click.play(0.4f); // Store the selected towers in the ServiceLocator for transferring across screens // (as an Array) Array towers = new Array<>(); @@ -130,9 +131,8 @@ public void clicked(InputEvent event, float x, float y) { turretDescriptionLabel = createButton("images/turret-select/imageedit_28_4047785594.png", "images/turret-select/imageedit_28_4047785594.png", "", "", turretDescriptionText); - BitmapFont font = new BitmapFont(); Label.LabelStyle labelStyle = new Label.LabelStyle(); - labelStyle.font = font; // Set your desired BitmapFont + labelStyle.font = getSkin().getFont("determination_mono_18"); // Set your desired BitmapFont descText = new Label(turretDescriptionText, labelStyle); descText.setWrap(true); descText.setWidth(190f); @@ -172,7 +172,7 @@ public void clicked(InputEvent event, float x, float y) { if (selectedTurrets.size() > MAX_SELECTED_TURRETS) { message.setText("You can only select up to 5 turrets."); } else { - message.setText("Select up to 5 turrets"); + message.setText("Select up to 5 towers"); } if (selectedTurrets.contains(turret)) { // Turret is already selected, unselect it @@ -222,9 +222,10 @@ public void clicked(InputEvent event, float x, float y) { // Set the position for turretDescriptionLabel turretDescriptionLabel.setPosition(turretDescriptionLabelX, turretDescriptionLabelY); - descText.setPosition(turretDescriptionLabelX + 18, turretDescriptionLabelY + 70); + descText.setPosition(turretDescriptionLabelX + 18, turretDescriptionLabelY + 65); // Add the actors to the stage + stage.addActor(backButton); stage.addActor(turretDescriptionLabel); stage.addActor(descriptionLabel); stage.addActor(descText);