Just to revive this thread for future users; you can easily use the following as Menu:
And this as Start:
Since .getObjectsAt() returns a List, you can use "contains" to search for your particular item.
public class Menu extends World
{
private boolean init = false;
public Menu()
{
super(1000, 600, 1);
setBackground("Back.png");
}
public void started()
{
if(!init) {
addObject(new Start(), 0, 0);
addObject(new TitleScreen(), 0, 0);
init = true;
}
}
}public class Start extends Actor
{
MouseInfo mouse;
public void act()
{
mouse = Greenfoot.getMouseInfo();
if(mouse != null && getObjectsAt(mouse.getX(), mouse.getY(), Start.class).contains(this)) {
setImage("Start/2.png");
} else {
setImage("Start/1.png");
}
if (Greenfoot.mouseClicked(this))
{
Greenfoot.setWorld(new Level1());
}
}
}