Sorry if this is a dumb question, but I'm having trouble with a public boolean.
I'm using the public boolean ballIn in my World class. then, in an actor class, I call upon the boolean:
for some reason, when i compile the code, an error regarding the ballIn == true is brought up, saying that "cannot find symbol - variable ballIn"
1 2 3 4 5 6 7 8 | public class Map extends World { Brick brick = new Brick(); public final int GAME_OVER = 3 ; public int state = MENU; private int level = 0 ; private boolean spacePressed = false ; public boolean ballIn = false ; |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | public class Ball extends Actor { int dx = Greenfoot.getRandomNumber( 6 ) - 3 ; int dy = 7 ; /** * Act - do whatever the Ball wants to do. This method is called whenever * the 'Act' or 'Run' button gets pressed in the environment. */ public void act() { if (ballIn == true ){ if (getX() <= width/ 2 || getX() >= getWorld().getWidth() - width/ 2 ) { dx = - 1 *dx; } |