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 c4388e0cf..c32cbc0de 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 @@ -58,6 +58,9 @@ private void addActors() { table.add(scrapsTb).width(scrapsTb.getWidth() * 0.5f).height(scrapsTb.getHeight() * 0.5f); table.add(crystalsTb).width(crystalsTb.getWidth() * 0.5f).height(crystalsTb.getHeight() * 0.5f); stage.addActor(table); + + scrapsTb.addAction(new SequenceAction(Actions.fadeIn(4f))); + crystalsTb.addAction(new SequenceAction(Actions.fadeIn(8f))); } 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 78bc3863e..905220f5d 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 @@ -53,6 +53,8 @@ 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))); } /** 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 1a3a15a8a..88b7b7b8b 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 @@ -298,11 +298,16 @@ public void clicked(InputEvent event, float x, float y) { stage.addActor(towerTable); // Animate the tower select buttons - animateTowerButton(tower1, 1040, 230); - animateTowerButton(tower2, 880, 230); - animateTowerButton(tower3, 720, 230); - animateTowerButton(tower4, 560, 230); - animateTowerButton(tower5, 400, 230); + int tower1Gap = Gdx.graphics.getWidth() /2 + (int) towerTable.getX()/2 + 400; + int tower2Gap = Gdx.graphics.getWidth() /2 + (int) towerTable.getX()/2 + 240; + int tower3Gap = Gdx.graphics.getWidth() /2 + (int) towerTable.getX()/2 + 80; + int tower4Gap = Gdx.graphics.getWidth() /2 + (int) towerTable.getX()/2 - 80; + int tower5Gap = Gdx.graphics.getWidth() /2 + (int) towerTable.getX()/2 - 240; + animateTowerButton(tower1, tower1Gap, 230); + animateTowerButton(tower2, tower2Gap, 230); + animateTowerButton(tower3, tower3Gap, 230); + animateTowerButton(tower4, tower4Gap, 230); + animateTowerButton(tower5, tower5Gap, 230); TooltipManager tm = TooltipManager.getInstance(); tm.initialTime = 3; @@ -389,7 +394,7 @@ public void unloadSounds() { } public void animateTowerButton(ImageButton button, float x, float y) { - button.setPosition(Gdx.graphics.getWidth()- x, Gdx.graphics.getHeight()); + button.setPosition(Gdx.graphics.getWidth() - x, Gdx.graphics.getHeight()); button.addAction(new SequenceAction(Actions.moveTo(Gdx.graphics.getWidth() - x, Gdx.graphics.getHeight() - y, 1f, Interpolation.fastSlow))); }