diff --git a/source/core/src/main/com/csse3200/game/components/gamearea/CurrencyDisplay.java b/source/core/src/main/com/csse3200/game/components/gamearea/CurrencyDisplay.java index c32cbc0de..84dfcebf0 100644 --- a/source/core/src/main/com/csse3200/game/components/gamearea/CurrencyDisplay.java +++ b/source/core/src/main/com/csse3200/game/components/gamearea/CurrencyDisplay.java @@ -1,5 +1,6 @@ package com.csse3200.game.components.gamearea; +import com.badlogic.gdx.Gdx; import com.badlogic.gdx.audio.Sound; import com.badlogic.gdx.graphics.Camera; import com.badlogic.gdx.graphics.Texture; @@ -56,11 +57,18 @@ private void addActors() { ServiceLocator.getCurrencyService().getCrystal().getAmount()); table.add(scrapsTb).width(scrapsTb.getWidth() * 0.5f).height(scrapsTb.getHeight() * 0.5f); + table.row(); table.add(crystalsTb).width(crystalsTb.getWidth() * 0.5f).height(crystalsTb.getHeight() * 0.5f); + table.setDebug(true); stage.addActor(table); - scrapsTb.addAction(new SequenceAction(Actions.fadeIn(4f))); - crystalsTb.addAction(new SequenceAction(Actions.fadeIn(8f))); + scrapsTb.setPosition(table.getX() - 200, Gdx.graphics.getHeight() - 205); + scrapsTb.addAction(new SequenceAction(Actions.moveTo(table.getX() + 20, Gdx.graphics.getHeight() - 205, + 1f, Interpolation.fastSlow))); + + crystalsTb.setPosition(table.getX() - 200, Gdx.graphics.getHeight() - 268); + crystalsTb.addAction(new SequenceAction(Actions.moveTo(table.getX() + 20, Gdx.graphics.getHeight() - 268, + 1f, Interpolation.fastSlow))); } private TextButton createButton(String imageFilePath, int value) { diff --git a/source/core/src/main/com/csse3200/game/components/gamearea/EngineerCountDisplay.java b/source/core/src/main/com/csse3200/game/components/gamearea/EngineerCountDisplay.java index 905220f5d..414fce76f 100644 --- a/source/core/src/main/com/csse3200/game/components/gamearea/EngineerCountDisplay.java +++ b/source/core/src/main/com/csse3200/game/components/gamearea/EngineerCountDisplay.java @@ -1,8 +1,10 @@ package com.csse3200.game.components.gamearea; +import com.badlogic.gdx.Gdx; import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.badlogic.gdx.graphics.g2d.TextureRegion; +import com.badlogic.gdx.math.Interpolation; import com.badlogic.gdx.scenes.scene2d.Touchable; import com.badlogic.gdx.scenes.scene2d.actions.Actions; import com.badlogic.gdx.scenes.scene2d.actions.SequenceAction; @@ -34,6 +36,7 @@ private void addActors() { table.top().left(); table.setFillParent(true); table.padTop(80f).padLeft(20f); + table.setDebug(true); Drawable drawable = new TextureRegionDrawable(new TextureRegion( new Texture("images/engineers/engineerBanner.png"))); @@ -54,7 +57,10 @@ private void addActors() { table.add(engineerTb).width(engineerTb.getWidth() * 0.5f).height(engineerTb.getHeight() * 0.5f); stage.addActor(table); - engineerTb.addAction(new SequenceAction(Actions.fadeIn(4f))); + // Animate the engineer count label + engineerTb.setPosition(table.getX() - 200, Gdx.graphics.getHeight() - 145); + engineerTb.addAction(new SequenceAction(Actions.moveTo(table.getX() + 20, Gdx.graphics.getHeight() - 145, + 1f, Interpolation.fastSlow))); } /** diff --git a/source/core/src/main/com/csse3200/game/components/maingame/MainGameDisplay.java b/source/core/src/main/com/csse3200/game/components/maingame/MainGameDisplay.java index f9d6c4de1..221a316cd 100644 --- a/source/core/src/main/com/csse3200/game/components/maingame/MainGameDisplay.java +++ b/source/core/src/main/com/csse3200/game/components/maingame/MainGameDisplay.java @@ -86,17 +86,17 @@ private void addActors() { // Create and position the tables that will hold the buttons. // Contains the tower build menu buttons - towerTable.top().padTop(50f); + towerTable.top().padTop(80f); towerTable.setFillParent(true); // Contains other buttons (just pause at this stage) - buttonTable.top().right().padTop(50f).padRight(80f); + buttonTable.top().right().padTop(80f).padRight(80f); buttonTable.setFillParent(true); progressTable.top().center().setWidth(500f); progressTable.setFillParent(true); - levelNameTable.top().left().padLeft(20f).padTop(20f); + levelNameTable.center().top().padLeft(20f).padTop(20f).pad(20f); levelNameTable.setFillParent(true); // Stores tower defaults, in case towers haven't been set in the tower select screen @@ -306,7 +306,7 @@ public void clicked(InputEvent event, float x, float y) { progressbar = new LevelProgressBar(500, 10); levelNameTable.setSkin(getSkin()); - levelNameTable.add(this.level, "title"); + levelNameTable.add(this.level, "default"); // Scale all the tower build buttons down // Add all buttons to their respective tables and position them diff --git a/source/core/src/main/com/csse3200/game/components/maingame/UIElementsDisplay.java b/source/core/src/main/com/csse3200/game/components/maingame/UIElementsDisplay.java index 6b0d93bf1..84aa11902 100644 --- a/source/core/src/main/com/csse3200/game/components/maingame/UIElementsDisplay.java +++ b/source/core/src/main/com/csse3200/game/components/maingame/UIElementsDisplay.java @@ -26,6 +26,7 @@ public class UIElementsDisplay extends UIComponent { private static final Logger logger = LoggerFactory.getLogger(UIElementsDisplay.class); private static final float Z_INDEX = 2f; private final Table buttonTable = new Table(); + private final Table timerTable = new Table(); private TextButton remainingMobsButton; private TextButton timerButton; @@ -44,15 +45,14 @@ private void addActors() { + ServiceLocator.getWaveService().getEnemyCount()); remainingMobsButton.setPosition(Gdx.graphics.getWidth(), Gdx.graphics.getHeight() - 230); - remainingMobsButton.addAction(new SequenceAction(Actions.moveTo(Gdx.graphics.getWidth() - 218, + remainingMobsButton.addAction(new SequenceAction(Actions.moveTo(Gdx.graphics.getWidth() - 217, Gdx.graphics.getHeight() - 230, 1f, Interpolation.fastSlow))); - buttonTable.top().right().padTop(130f).padRight(80f); + buttonTable.top().right().padTop(160f).padRight(80f); buttonTable.setFillParent(true); buttonTable.add(remainingMobsButton).right(); - buttonTable.row(); - buttonTable.add(timerButton); + stage.addActor(buttonTable); @@ -82,10 +82,11 @@ public void createTimerButton() { timerButton = ButtonFactory.createButton("Next wave in:" + (ServiceLocator.getWaveService().getNextWaveTime() / 1000)); timerButton.setPosition(Gdx.graphics.getWidth(), Gdx.graphics.getHeight() - 300); - timerButton.addAction(new SequenceAction(Actions.moveTo(Gdx.graphics.getWidth() - 445, + timerButton.addAction(new SequenceAction(Actions.moveTo(Gdx.graphics.getWidth() - 435, Gdx.graphics.getHeight() - 300, 1f, Interpolation.fastSlow))); + timerButton.setDisabled(true); buttonTable.row(); - buttonTable.add(timerButton).padRight(10f); + buttonTable.add(timerButton); } /** @@ -106,10 +107,12 @@ public void updateTimerButton() { String finalTime = String.format("%02d:%02d", minutes, seconds); if (ServiceLocator.getTimeSource().getTime() < ServiceLocator.getWaveService().getNextWaveTime()) { if (!findActor(timerButton)) { + remainingMobsButton.setDisabled(false); createTimerButton(); } timerButton.setText("Next wave in: " + finalTime); } else { + remainingMobsButton.setDisabled(true); timerButton.addAction(new SequenceAction(Actions.fadeOut(1f), Actions.removeActor())); stage.act(); stage.draw();