createWorld function

void createWorld(
  1. String scenarioFile,
  2. Player player,
  3. [num speed = 1]
)

Initializes the world with the specified scenarioFile and shows it.

The player is the instance where the behaviour is programmed in.

The speed is the duration between the execution of actions (in seconds).

Implementation

void createWorld(String scenarioFile, Player player, [num speed = 1]) {

  World world = new World(player, speed);

  // Initialize the world.
  world.init(scenarioFile).catchError((e) {
    // Show an alert if it is a HelloDartException.
    html.window.alert(e.toString());
  }, test: (e) => e is HelloDartException);
}