class hlshell.HLShell(HShell)

HLShell is a subclass of HShell for games that consist of a sequence of levels. It is designed to be used in conjunction with an HLGame.

Constructor

HLShell(game, options)
Attaches the HLShell to the specified game (an HLGame or subclass) and options (an Options instance or subclass).

Methods

The following methods implement the commands found on the default main menu screen. You may also want to call them yourself if you provide other ways of invoking these commands.
restart_level_cmd()
Implementation of the "Restart Level" command.
open_level_set_cmd()
Implementation of the "Play Custom Levels" menu command.

level_won(self, result)
This method is called when a level is completed successfully. It is passed the value returned by the game object's level_is_completed() method. By default, it loads the next level and starts playing it, or if there are no more levels, the game_is_completed() method is called.

level_lost(self, result)
This method is called when a level is completed unsuccessfully. It is passed the value returned by the game object's level_is_completed() method. By default, it switches to the main menu screen and gives the user the option to restart the level.
game_completed(result)
This method is called when the last level of the game is completed successfully. By default, it simply switches to the main menu screen, but you can override it to take some other action such as showing a completion screen. It is passed the value returned by the game object's level_is_completed() method.
You probably won't need to call or override the following methods.
load_file(path)
Loads the specified file, which may be either a level file, a level set, or a saved game file. If it is a level file, loads the level and starts playing it. If it is a level set, loads and starts the first level from it. If it is a saved game, restores the game.
load_level_file(path)
Loads the specified level file. Errors are reported to the user. Raises Cancel if cancelled or an error occurs.
load_level_set(path)
Makes the specified directory the current level set and loads the first level. Errors are reported to the user. Raises Cancel if cancelled or an error occurs.
load_next_uncompleted_level()
Loads the next uncompleted level. If there are no more levels, sets game.level to None. Errors are reported to the user. Raises Cancel if cancelled or an error occurs.
---