Hi so im having some trouble with my game. It won't allow me to compile because it says that I already defined the actor once, and when i remove my Actor actor = getOneIntersectingObject(Junk.class); portion of the code it says that if(actor != null) is an unreachable statement. Also I know that it adds points when an apple falls, but I don't think i formated it correctly for subtracting points when junk falls. Thank you!
public int checkCatch()
{
Actor actor = getOneIntersectingObject(Apple.class);
if(actor != null)
{
getWorld().removeObject(actor);
Greenfoot.playSound("khowb.wav");
return 100;
} else
return 0;
Actor actor = getOneIntersectingObject(Junk.class);
if(actor != null)
{
getWorld().removeObject(actor);
Greenfoot.playSound("khowb.wav");
return -100;
} else
return 0;
}
