SweatyReptile/loser — pull request #28 by mnopbop (2014-05-09 02:02:32+00:00)
Title: Level Manager

Create LevelManager and allow it to handle the instantiation and switching of `LevelScreens` and their associtated `LevelTitleScreens`.

LevelManager does not currently have a way to manage sequences of Levels; that will be handled in a seperate pull request.

Currently, the only features of LevelManager are:
* Instantiate `LevelScreens` and associate them with an alias
* Switch to a level based on its alias

As an example of the first point, a particular configuration of `TestScrollingLevelScreen` is currently associated with the alias `test_home`. It is instantiated in the LevelManager constructor like so:
```
instantiate("test_home", "TestScrollingLevelScreen", "WELCOME TO THE JUNGLE", 3.2f, 1.8f, 5f);
```
This behavior is achieved via reflection.

As an example of the second point, when `LoadingScreen` is finished loading, it calls `levelManager.level("test_home")`, and LevelManager handles switching the level properly:
```
@Override
public void finish() {
levelManager.level("test_home");
}
```
This is a special case though, as regular levels will **not** switch to a new level in this way. Instead, the ultimate goal might be to allow a level to call `LevelManager.nextlevel()` (name TBD) in order to advance the game to the next appropriate level.

LevelManager and its methods were designed with the projection that LevelManager methods will be directly accessible via the in-game console. Were this not the case, some much more straightforward design decisions could have been made, like not using reflection to instantiate subtypes.