don't understand what is wrong
1 2 3 4 5 6 7 8 9 10 11 12 13 | private void eatCrab() { Actor crab; crab = getOneObjectAtOffset ( 0 , 0 ,Crab. class ); if (crab != null ) { int x = Greenfoot.getRandomNumber(getWorld().getWidth()); int y = Greenfoot.getRandomNumber(getWorld().getHeight()); Crab.setLocation(x, y); lifeCounter.add( 1 ); Greenfoot.playSound ( "eating.wav" ); } } |