Change Opacity On Ui During Game

Discussion in 'How Can I...?' started by McGee Technologies, Aug 23, 2019.

  1. McGee Technologies

    McGee Technologies Boxer

    Joined:
    Jan 3, 2018
    Messages:
    33
    Likes Received:
    2
    Hey everyone,

    Im working on a new game and Im new to Java (more experienced with C and programming for Electrical Engineering). What Im trying to accomplish is that when the players health drops to a certain value that a PNG sequence on the levels UI is set to 100(full) so it will display. Ive attached a screenshot of the code and highlighted specifically what Im talking about. the reason that I used .setVisible on the others and .setOpacity on the one I want to display on UI is because the others are a single PNG while the one I want is a PNG sequence.

    Thanks in advance to anyone that can help. Im going to keep messing with it and if I figure it out prior to an answer ill post the solution
     

    Attached Files:

  2. weboha

    weboha Avid Boxer

    Joined:
    Aug 8, 2018
    Messages:
    239
    Likes Received:
    178
    you can use only 0 and 1.
    0 for hide, 1 for visible.

    this.ui().find('button')[0].setOpacity(0);
     
  3. McGee Technologies

    McGee Technologies Boxer

    Joined:
    Jan 3, 2018
    Messages:
    33
    Likes Received:
    2
    @weboha Much appreciated!
     

Share This Page