Skip to content

Commit

Permalink
Fixed potential code smells involving float and int conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
Hasakev committed Oct 16, 2023
1 parent 0d0f960 commit 1232b9d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,9 @@ private void addActors() {
TextButton pauseBtn = ButtonFactory.createButton("Pause");

// Starting animation for pause button
pauseBtn.setPosition(Gdx.graphics.getWidth(), Gdx.graphics.getHeight() - 150);
pauseBtn.addAction(new SequenceAction(Actions.moveTo(Gdx.graphics.getWidth() - 200,
Gdx.graphics.getHeight() - 150, 1f, Interpolation.fastSlow)));
pauseBtn.setPosition(Gdx.graphics.getWidth(), Gdx.graphics.getHeight() - 150f);
pauseBtn.addAction(new SequenceAction(Actions.moveTo(Gdx.graphics.getWidth() - 200f,
Gdx.graphics.getHeight() - 150f, 1f, Interpolation.fastSlow)));

// Spawns a pause menu when the button is pressed.
pauseBtn.addListener(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ private void addActors() {
remainingMobsButton = ButtonFactory.createButton("Mobs:"
+ ServiceLocator.getWaveService().getEnemyCount());

remainingMobsButton.setPosition(Gdx.graphics.getWidth(), Gdx.graphics.getHeight() - 230);
remainingMobsButton.addAction(new SequenceAction(Actions.moveTo(Gdx.graphics.getWidth() - 218,
Gdx.graphics.getHeight() - 230, 1f, Interpolation.fastSlow)));
remainingMobsButton.setPosition(Gdx.graphics.getWidth(), Gdx.graphics.getHeight() - 230f);
remainingMobsButton.addAction(new SequenceAction(Actions.moveTo(Gdx.graphics.getWidth() - 218f,
Gdx.graphics.getHeight() - 230f, 1f, Interpolation.fastSlow)));

buttonTable.top().right().padTop(130f).padRight(80f);
buttonTable.setFillParent(true);
Expand Down Expand Up @@ -81,9 +81,9 @@ 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,
Gdx.graphics.getHeight() - 300, 1f, Interpolation.fastSlow)));
timerButton.setPosition(Gdx.graphics.getWidth(), Gdx.graphics.getHeight() - 300f);
timerButton.addAction(new SequenceAction(Actions.moveTo(Gdx.graphics.getWidth() - 445f,
Gdx.graphics.getHeight() - 300f, 1f, Interpolation.fastSlow)));
buttonTable.row();
buttonTable.add(timerButton).padRight(10f);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,20 +88,9 @@ public boolean touchDown(int screenX, int screenY, int pointer, int button) {
Vector2 cursorPosition = new Vector2(worldCoordinates.x, worldCoordinates.y);
Entity clickedEntity = entityService.getEntityAtPosition(cursorPosition.x, cursorPosition.y);

// //temp fix to prevent upgrading of new towers
// if (clickedEntity!= null && (clickedEntity.getComponent(RicochetTowerAnimationController.class) != null ||
// clickedEntity.getComponent(PierceTowerAnimationController.class) != null ||
// clickedEntity.getComponent(FireworksTowerAnimationController.class) != null)) {
// return false;
// }
// //

// If the clicked position contains a turret, and the turret is upgradable and not a TNT tower
if (clickedEntity != null && clickedEntity.getComponent(TowerUpgraderComponent.class) != null
) {
// TNT TowerUpgraderComponent can be removed later, but possibly useful for future sprint.
// Clear all existing upgrade tables
// logger.info("clickedEntity: " + clickedEntity);
//
clearUpgradeTables();
// Check if there is an existing upgrade table for this turret entity
Expand Down

0 comments on commit 1232b9d

Please sign in to comment.