From dd85cf2ac490627201b7a48e1105964e871fcf32 Mon Sep 17 00:00:00 2001 From: Nawal Date: Mon, 16 Oct 2023 23:39:50 +1000 Subject: [PATCH] fixing code smells/cleaning up code in Currency, HumanAnimationController --- .../components/player/HumanAnimationController.java | 12 ------------ .../main/com/csse3200/game/currency/Currency.java | 3 +-- .../csse3200/game/screens/LevelSelectScreen.java | 13 ++----------- 3 files changed, 3 insertions(+), 25 deletions(-) diff --git a/source/core/src/main/com/csse3200/game/components/player/HumanAnimationController.java b/source/core/src/main/com/csse3200/game/components/player/HumanAnimationController.java index 2bd5fecf7..5317c6b4b 100644 --- a/source/core/src/main/com/csse3200/game/components/player/HumanAnimationController.java +++ b/source/core/src/main/com/csse3200/game/components/player/HumanAnimationController.java @@ -107,7 +107,6 @@ void animateLeftWalk() { } else { animator.startAnimation(WALKL_ANIM); } -// runSound.play(); } /** @@ -205,15 +204,4 @@ public boolean isClicked() { public void setClicked(boolean clicked) { this.clicked = clicked; } - - /** - * Deseelects the engineer entity by starting the appropriate animation without an outline - * and removes the engineer menu from the stage - * @param currentAnimation the current animation of the entity - */ - public void deselectEngineer(String currentAnimation) { - AnimationRenderComponent animator = this.entity.getComponent(AnimationRenderComponent.class); - animator.startAnimation(currentAnimation.substring(0, currentAnimation.lastIndexOf('_'))); - setClicked(false); - } } \ No newline at end of file diff --git a/source/core/src/main/com/csse3200/game/currency/Currency.java b/source/core/src/main/com/csse3200/game/currency/Currency.java index 81820ad5f..d3d974a26 100644 --- a/source/core/src/main/com/csse3200/game/currency/Currency.java +++ b/source/core/src/main/com/csse3200/game/currency/Currency.java @@ -4,7 +4,6 @@ import org.slf4j.LoggerFactory; public abstract class Currency { - private static final Logger logger = LoggerFactory.getLogger(Currency.class); // The logo of the currency @@ -53,7 +52,7 @@ public String getTexture() { * @param addedAmount The amount the currency will be incremented by. */ public void modify(int addedAmount) { - logger.debug("Modifying " + this.getClass().getSimpleName() + "by " + addedAmount); + logger.debug(String.format("Modifying %s by %d", this.getClass().getSimpleName(), addedAmount)); this.amount += addedAmount; } diff --git a/source/core/src/main/com/csse3200/game/screens/LevelSelectScreen.java b/source/core/src/main/com/csse3200/game/screens/LevelSelectScreen.java index 83b763d7f..9a086f2a5 100644 --- a/source/core/src/main/com/csse3200/game/screens/LevelSelectScreen.java +++ b/source/core/src/main/com/csse3200/game/screens/LevelSelectScreen.java @@ -6,7 +6,6 @@ import com.badlogic.gdx.graphics.GL20; import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.g2d.BitmapFont; -import com.badlogic.gdx.graphics.g2d.GlyphLayout; import com.badlogic.gdx.graphics.g2d.Sprite; import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.badlogic.gdx.math.Rectangle; @@ -16,24 +15,14 @@ import com.badlogic.gdx.scenes.scene2d.ui.Table; import com.badlogic.gdx.scenes.scene2d.ui.TextButton; import com.badlogic.gdx.scenes.scene2d.utils.ClickListener; -import com.badlogic.gdx.utils.TimeUtils; import com.badlogic.gdx.utils.viewport.FitViewport; import com.csse3200.game.GdxGame; -import com.csse3200.game.components.mainmenu.MainMenuDisplay; -import com.csse3200.game.entities.factories.RenderFactory; -import com.csse3200.game.rendering.Renderer; import com.csse3200.game.screens.text.AnimatedText; -import com.csse3200.game.screens.Planets; import com.csse3200.game.services.GameEndService; import com.csse3200.game.services.ResourceService; import com.csse3200.game.services.ServiceLocator; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.w3c.dom.Text; - -import java.util.Arrays; - -import static com.badlogic.gdx.scenes.scene2d.ui.Table.Debug.table; /** * The game screen where you can choose a planet to play on. @@ -189,6 +178,8 @@ public void render(float delta) { stage.act(Math.min(Gdx.graphics.getDeltaTime(), 1 / 30f)); stage.draw(); } + + @Override public void resize(int width, int height) { stage.getViewport().update(width, height, true); }