Skip to content

Commit

Permalink
Finalised the animations for tower select buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
shiv-0831 committed Oct 16, 2023
1 parent b001b87 commit 3e5c6ff
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)));
}

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

0 comments on commit 3e5c6ff

Please sign in to comment.