I know it's probably a stupid fault I made, but I can't figure it out. Can anyone tell me what I did wrong? Here's my code for background changing:
public boolean atWorldEdge()
{
return (atHorizontalEdge() || atVerticalEdge());
}
private boolean atVerticalEdge()
{
return (getX()<20 || getX()>getWorld().getWidth()-20);
}
private boolean atHorizontalEdge()
{
return (getY()<20 || getY()>getWorld().getHeight()-20);
}
if(atWorldEdge())
{
if(atSideEdge())
{
getWorld().setBackground("wolf-love.jpg");
int w=getWorld().getWidth();
setLocation((getX()+w-60)%(w-40)+20, getY());
}
It's saying the "if(atWorldEdge())" is an illegal start of type, how do I fix that? I want my character to hit the edge of the world and then when that happens have the background scene change to another.
![Twitter](/assets/twitter-4e19209ef84344ee0c433f4c7bad8d49.png)
![Twitter.hover](/assets/twitter.hover-1fb19a5bafc50deace8f88eaec867845.png)