TGame Data Class
Manage the game data and have the ability to be saved/restored or started/paused/restarted
uGameData.TGameData
The TGameData type exposes the following members.
Name | Description | |
---|---|---|
![]() | Create | Used to create a new instance of this class. It's better to use TGameData.DefaultGameData if you don't need to manage complex things on your game data. |
![]() | Destroy | Never call it, use only "Free" or "FreeAndNil" if you called the Create() method to get a new instance of this game. |
Name | Description | |
---|---|---|
![]() | FileName | The FileName for this game (no path, no extension) if opened by LoadFromFile(WithAName) or it has been saved by SaveToFile(WithAName) |
![]() | HasChanged | Returns True if a game parameter has changed since last Clear(), LoadXXX() or SaveXXX() |
![]() | IsPaused | Returns True after a load() or a pausegame() Returns False after a Clear() |
![]() | IsPlaying | Returns True after a StartANewGame() or ContinueGame() Returns False after a PauseGame() or StopGame() |
![]() | Level | It's the current player level |
![]() | NbLives | It's the current player lives number level |
![]() | Path | Path to the folder where games will be saved |
![]() | Score | It's the current player score |
![]() | UserPseudo | It's the current player pseudo (if it has been asked) |
Name | Description | |
---|---|---|
![]() | Clear | Used to clean current instance and reset all properties and fields to their default values |
![]() | ContinueGame | Start the game without clearing the game data before Use it to continue a game after a pause or loading it |
![]() ![]() | DefaultGameData | Get the instance of default game data. In most cases it's better to use it than creating a new instance If you work on a descendnt of TGameData, don't call this method, create your own or use the constructor. |
![]() | LoadFromFile | Used to load the game data from a file after clearing the instance. |
![]() | LoadFromStream | Used to load the game data from a stream. |
![]() | PauseGame | Call it when you pause (stop temporary) a game and want to continue it in the future |
![]() | SaveToFile | Used to save current game data to a file |
![]() | SaveToStream | Used to save current game data to a stream |
![]() | StartANewGame | Start the game after clearing the game data |
![]() | StopGame | Call it when you stop a game |
To add new features and store other things, it's better to inherits from this class. It allow you to update thise file with the future templates updates.