Quote:
Originally Posted by Oromus
The issue is that you need to change
Code:
if(XboxController.button[0] == true)
to
Code:
if(XboxController.button[0].get() == true)
The key change there being the addition of ".get()". What your code is doing is saying "If this button is true, run my code". A button won't be equal to true because it's a Button, not a boolean. Using "XboxController.button[0].get()" changes that line of code to "If this button's STATE is true (pressed), run my code". This should fix your problem.
|
In addition to what he stated, this would be as good a time to learn java operators as any.
A few common ones include
Code:
if (leftStick.getRawButton(5)) {} // if the button is held(or true) it would run the code
if (!leftStick.getRawButton(5)) {} // the ! operator inverts your boolean, so when the 5 button is not held it would run this code using the == true is a bit redundant when java interprets true as the default for running your if anyway and using ! would invert it to false.
if (leftStick.getRawButton(5) && rightStick.getRawButton(5)) {} // this would only run the if when left and(&&) right stick are both held