I'm making a game that has the option to click on Info. When I click it, it creates a new world and displays that world. I used the Greenfoot.isKeyDown method to make a back button to the main menu but it doesn't seem to be working. Maybe the answer is really simple but I'm not sure what went wrong.
Here's is the code for the new InfoPage world:
Here's the code for the info button in the main menu:
I can provide more of the code if needed!
public class InfoPage extends World { public InfoPage() { super(400, 350, 1); if (Greenfoot.isKeyDown("M")){ Greenfoot.setWorld(new Menu()); } } }
public class Info extends Actor { public void act() { if (Greenfoot.mouseClicked(this)) { Greenfoot.setWorld(new InfoPage()); } } }