1
\$\begingroup\$

I have a table that acts as the HUD for my game. It features a bar (as a text button) and label showing how much shields are left. So I initially add the shield bar to the table, with the cell set at a certain size to correspond to maximum width of the shield bar when shields are at 100%.

I then want to be able to change the width of the shield bar to show shields dropping but my code doesn't seem work. Is anyone able to tell me how I change the size of a button after having added it to a table and having added it to the stage?

// Add shield bar and label to table
table.add(enemyShieldBar).align(Align.right).colspan(2).expandX();
table.add(enemyshieldLabel);
table.add(fillerLabel).row();

// Attempt to update the label and button size
enemyshieldLabel.setText("new text ");
enemyShieldBar.setSize(5,5);
\$\endgroup\$
-3
\$\begingroup\$

you can use this, just use width and height methods.

table.add(enemyshieldLabel).width(300).height(500).align(Ali.......
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.