i have two characters and i have levels games. after playing a certain level, I would like to continue the game with the same character, but it does not save the character. What can be done? anyone have an idea?


Level2 level2 = new Level2(player);
public Level2(Player player) { super(600, 400, 1); addObject(player, 300, 200); // etc.
public Level2() { super(600, 400, 1); addObject(SelectionWorldNameHere.player, 300, 200); // etc. }
import greenfoot.*; public class SelectionWorld extends World { public static Actor chosenPlayer; public SelectionWorld() { super(600, 400, 1); // etc. } // etc. }
if (SelectionWorld.chosenPlayer == null) Greenfoot.setWorld(new SelectionWorld()); // or addObject(SelectionWorld.chosenPlayer, 300, 200);
chosenPlayer = new PlayerA();
chosenPlayer = playerA;