I am trying to make a pinball bounce a random direction off of a bumper but am at a stalemate with my knowledge. I have written:
public boolean onBumper()
{
if(isTouching(Bumper.class))
{
return true;
}
else
{
return false;
}
if(onBumper(true))
{
setRotation(Greenfoot.getRandomNumber(360));
}
else
{
move(10);
}
}
This keep returning an error but to my knowledge it seems like this should work just fine. Can someone please help explain this to me! Thank you so much.