Search code examples
classlibgdxboolean

LibGDX how do I use one boolean in all class


I have one class that I put the Boolean in but I need to use it In a different class so can anyone tell me what to do To get the boolean to work for the other classes to

https://i.sstatic.net/8clF1.png image 2 https://i.sstatic.net/wxA3N.png


Solution

  • First of all check this post, we discourage screenshots of code and/or errors so please post code in future instead of screenshot.


    From screenshot on is non-static data member of playbutton class. You can't use non-static data member in all class.

    You need an object of playbutton, if you want to access any non-static data member.

    playbutton x=new playbutton();
    x.on=true;
    

    I'll recommend you to follow naming conventions in java for better coding experience.