class

MenuCommands::LoadSavedGame

Inherits Command < Reference < Object

Constructors

new(save_path : String, key, description, default_scene : Scene.class)
Source

Instance methods

execute(state : State, user_input : String | Nil) : State

Performs extra processing on the user input. This will run for both keyed and keyless commands. Override this to add your custom logic.

When using nested commands, commands are executed in order of selection by the player.

This is one of the most important parts of a command, because it allows us to change state in response to the player's choices in the game.

Example

If we had a skill field on Character we could update it here to give our player more abilities.

def execute(state : State, user_input : String?) : State
  state.character.skill += 1
  return state
end
Source