Hello!
I have this boolean method that returns checkForGreenBubble:
What I want to do is to use this method here:
Or alternatively use the returned value instead of the method:
But I get an error message in both cases: "non-static method cannot be referenced from a static context" in the firs case and an indefined variable in the second.
What must be done to solve this?
Thanks on beforehand!
1 2 3 4 5 6 7 8 9 10 11 12 13 | public boolean checkForGreenBubble(Color bubbleColor) { Bubble bubble = (Bubble)getOneIntersectingObject(Bubble. class ); boolean checkForGreenBubble = false ; if (bubble != null && bubbleColor == Color.GREEN ) { checkForGreenBubble = true ; } return checkForGreenBubble; |
1 2 3 4 5 6 | private void changeColor(Color newColor) { if (Girl.checkForGreenBubble(Color.GREEN)) { //some code } |
1 2 3 4 5 6 | private void changeColor(Color newColor) { if (checkForGreenBubble) { //some code } |