What I'd like to do is have a new Food.class be created whenever the amount of Food.class on the screen is less than 1. Could someone help me out?
1 2 3 4 5 6 7 8 9 10 11 12 | public WombatWorld() { super ( 800 , 800 , 1 ); prepare(); for ( int i = 0 ; i < 1 ; i++) { int x = Greenfoot.getRandomNumber(getWidth() - 60 ); int y = Greenfoot.getRandomNumber(getHeight() - 60 ); addObject( new Food(), x, y); } } |