From 8ca8fc4bc5434ef5757a35f58f4511c806812806 Mon Sep 17 00:00:00 2001 From: Ahmad Abu-Aysha <111224176+The-AhmadAA@users.noreply.github.com> Date: Mon, 16 Oct 2023 20:25:04 +1000 Subject: [PATCH] added Pause menu opening animation --- .../game/components/maingame/MainGameDisplay.java | 2 +- .../components/pausemenu/PauseMenuButtonComponent.java | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) 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..28c05d6b7 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 @@ -15,7 +15,6 @@ import com.badlogic.gdx.scenes.scene2d.utils.ClickListener; import com.badlogic.gdx.utils.Array; import com.csse3200.game.GdxGame; -import com.csse3200.game.components.pausemenu.PauseMenuButtonComponent; import com.csse3200.game.entities.Entity; import com.csse3200.game.entities.factories.PauseMenuFactory; import com.csse3200.game.screens.TowerType; @@ -316,6 +315,7 @@ public void clicked(InputEvent event, float x, float y) { towerTable.add(tower3).padRight(10f); towerTable.add(tower4).padRight(10f); towerTable.add(tower5).padRight(10f); + towerTable.stack(new Label(String.format("%s", towers.get(0).getPrice()), getSkin())); towerTable.row(); towerTable.add("1", "small"); towerTable.add("2", "small"); diff --git a/source/core/src/main/com/csse3200/game/components/pausemenu/PauseMenuButtonComponent.java b/source/core/src/main/com/csse3200/game/components/pausemenu/PauseMenuButtonComponent.java index 0f4dafbee..cb130da50 100644 --- a/source/core/src/main/com/csse3200/game/components/pausemenu/PauseMenuButtonComponent.java +++ b/source/core/src/main/com/csse3200/game/components/pausemenu/PauseMenuButtonComponent.java @@ -123,7 +123,15 @@ public void changed(ChangeEvent changeEvent, Actor actor) { window.setHeight(windowSizeY); window.setX((ServiceLocator.getRenderService().getStage().getWidth() / 2) - (windowSizeX / 2)); window.setY((ServiceLocator.getRenderService().getStage().getHeight() / 2) - (windowSizeY / 2)); - window.addAction(Actions.fadeIn(0.8f, Interpolation.bounceIn)); + + // Animate the pause menu opening + window.setPosition(((float) Gdx.graphics.getWidth() / 2) - (windowSizeX / 2),0); + window.addAction(new SequenceAction(Actions.moveTo( + ( ((float) Gdx.graphics.getWidth() / 2) - (windowSizeX / 2) ), + ( ((float) Gdx.graphics.getHeight() / 2) - (windowSizeY / 2) ), + 0.3f, + Interpolation.fastSlow), + Actions.fadeIn(0.3f))); stage.addActor(window); }