Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: Quest

[17:7] extends: FxObj

Wraps FXGL's Quest, a named container of QuestObjectives. Objectives can be int-threshold (variable >= value) or boolean- equality. A quest moves through ACTIVE, COMPLETED, or FAILED states; the state is the aggregate of its objectives' states. Quests are typically created via QuestService.addQuest (reached through fxgl.getQuestService) so they are registered with the service that drives their update loop.

Methods

  • Quest (string Name, object VarsMap = null)

    Creates a new Quest with the given name. Backed by an FXGL PropertyMap (typically the world's properties); pass a PropertyMap wrapper or null to use a fresh empty map.

    • @p Name is the quest name.
    • @p VarsMap is a PropertyMap wrapper bound to world properties, or null for a fresh map.
  • adopt (object Ajo)

    Wraps an existing Quest AussomJavaObject.

    • @p Ajo is an AussomJavaObject around a Quest.
    • @r A new wrapper.
  • getName ()

    Returns the quest name.

    • @r A string.
  • addIntObjective (string Description, string VarName, int VarValue)

    Adds an int-threshold objective: the objective completes when the named world property is greater than or equal to the target value.

    • @p Description is the objective description.
    • @p VarName is the world-property name to watch.
    • @p VarValue is the target int value.
    • @r An AussomJavaObject around the QuestObjective.
  • addBooleanObjective (string Description, string VarName, bool VarValue)

    Adds a boolean-equality objective: the objective completes when the named world property equals the target value.

    • @p Description is the objective description.
    • @p VarName is the world-property name to watch.
    • @p VarValue is the target bool value.
    • @r An AussomJavaObject around the QuestObjective.
  • getState ()

    Returns the quest's current state name (ACTIVE, COMPLETED, FAILED).

    • @r A string.
  • setName (string Name)

    Sets the quest name.

    • @p Name is the new name.
    • @r this object
  • nameProperty ()

    Returns the underlying name StringProperty for binding to a UI label.

    • @r An AussomJavaObject around a StringProperty.
  • stateProperty ()

    Returns the underlying state ObjectProperty for binding to a UI label or change listener.

    • @r An AussomJavaObject around an ObjectProperty.
  • isStarted ()

    Returns whether the quest has been started (registered via QuestService.startQuest).

    • @r A bool.
  • objectivesProperty ()

    Returns the live list of quest objectives as AussomJavaObjects.

    • @r An AussomJavaObject around an ObservableList.
  • removeObjective (object ObjectiveObj)

    Removes the given objective from the quest.

    • @p ObjectiveObj is an AussomJavaObject around a QuestObjective (returned by add*Objective).
    • @r this object
  • addIntObjectiveTimed (string Description, string VarName, int VarValue, double DurationSeconds)

    Adds an int-threshold objective with a time limit. The objective fails if the time limit elapses before the threshold is reached.

    • @p Description is the objective description.
    • @p VarName is the world-property name to watch.
    • @p VarValue is the target int value.
    • @p DurationSeconds is the time limit in seconds.
    • @r An AussomJavaObject around the QuestObjective.
  • addBooleanObjectiveTimed (string Description, string VarName, bool VarValue, double DurationSeconds)

    Adds a boolean-equality objective with a time limit.

    • @p Description is the objective description.
    • @p VarName is the world-property name to watch.
    • @p VarValue is the target bool value.
    • @p DurationSeconds is the time limit in seconds.
    • @r An AussomJavaObject around the QuestObjective.