This the other button. I only use in the main menu,
public class Back extends Buttons
{
public Back()
{
if (Greenfoot.mouseMoved(this))
{
setImage("back_hi.jpg");
}
if (Greenfoot.mouseMoved(getWorld()))
{
setImage("back.jpg");
}
}
/**
* Act - do whatever the Back wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
BacktoMain();
if (Greenfoot.mouseMoved(this))
{
setImage("back_hi.jpg");
}
if (Greenfoot.mouseMoved(getWorld()))
{
setImage("back.jpg");
}
}
public void BacktoMain()
{
if (Greenfoot.mouseClicked(this))
{
Greenfoot.setWorld(new Main());
}
if (Greenfoot.mouseMoved(this))
{
setImage("back_hi.jpg");
}
if (Greenfoot.mouseMoved(getWorld()))
{
setImage("back.jpg");
}
}
}