Skip to content

Commit

Permalink
fixing code smells/cleaning up code in Currency, HumanAnimationContro…
Browse files Browse the repository at this point in the history
…ller
  • Loading branch information
nawal-0 committed Oct 16, 2023
1 parent 39c2636 commit dd85cf2
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ void animateLeftWalk() {
} else {
animator.startAnimation(WALKL_ANIM);
}
// runSound.play();
}

/**
Expand Down Expand Up @@ -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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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.
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit dd85cf2

Please sign in to comment.