I'm making a game with 2 two different game modes and would like to program a replay button that would identify the game mode to make a new same world.
Something in this spirit (now I know that .equals() doesn't work like this but just so you have an idea of what I want to make):
Does anyone have any idea on how to achieve this?
if(Greenfoot.mouseClicked(this)) { if(getWorld().equals(ArcadeWorld.class)) { Greenfoot.setWorld(new ArcadeWorld()); } if(getWorld().equals(ClassicWorld.class)) { Greenfoot.setWorld(new ClassicWorld()); } }