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!
public boolean checkForGreenBubble(Color bubbleColor) { Bubble bubble = (Bubble)getOneIntersectingObject(Bubble.class); boolean checkForGreenBubble = false; if(bubble != null && bubbleColor == Color.GREEN ) { checkForGreenBubble = true; } return checkForGreenBubble;
private void changeColor(Color newColor) { if(Girl.checkForGreenBubble(Color.GREEN)) { //some code }
private void changeColor(Color newColor) { if(checkForGreenBubble) { //some code }