Hi, I'm relatively new to Greenfoot and coding in general. Currently, I'm experiencing an issue on a button I've created that is supposed to change the world to the StartScreen when clicked on but it doesn't. No errors show up in the code and I'm not quite sure how to solve this. The code goes:
public void act()
{
MouseInfo mouse = Greenfoot.getMouseInfo();
//Change Button.class to the name of your button class.
if (mouse != null) {
//change the file to what you want for when the mouse is not over the button.
setImage("next1.png");
java.util.List objects = getWorld().getObjectsAt(mouse.getX(), mouse.getY(), NextButton2.class);
for (Object object : objects)
{
if (object == this)
{
//change the file to what you want for when the mouse is over the button.
setImage("next2.png");
}
}
}
if (Greenfoot.mouseClicked(this)) {
Greenfoot.setWorld(new StartScreen());
}
}

