Skip to content

Commit

Permalink
Added click sounds to every button and adjusted description text font
Browse files Browse the repository at this point in the history
  • Loading branch information
SonjaMcNeilly committed Oct 17, 2023
1 parent c7ac03e commit 1732956
Showing 1 changed file with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<TowerType> towers = new Array<>();
Expand All @@ -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);
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 1732956

Please sign in to comment.