/** * If the level is completed, load the next level. If the level is complete set the player's * position at the starting position. If no more levels are available quit the game and * congratulate the player. */ @Override public void progress() { try { myPlayfield.getSpriteGroup("avatar").getActiveSprite().setLocation(100, 300); myLevelManager.loadNextLevel(); } catch (LevelException e) { /* * TODO: Set up a better way to handle a win. */ System.out.println("You win!"); myLevelManager.getCurrentGame().finish(); } }
/** Checks the to see if the level has been completed. */ @Override public boolean checkCompletion(LevelManager levelManager) { return myPlayfield.getSpriteGroup("door").getActiveSprite() == null; }