Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: Achievement

[17:7] extends: FxObj

Wraps FXGL's Achievement, a value type identified by name with a description and a (varName, varValue) trigger. When the named world property reaches varValue (greater-than-or-equal for ints and doubles, equality for booleans), the achievement unlocks. Achievements must be registered via GameSettings before the engine starts; see fxgl.GameSettings.getAchievements (added in chunk 6 deferred test patterns) for the registration path.

Methods

  • Achievement (string Name, string Description, string VarName, VarValue)

    Creates a new Achievement with the given name, description, trigger variable name, and trigger value.

    • @p Name is the display name.
    • @p Description is the unlock description.
    • @p VarName is the world-property name to watch.
    • @p VarValue is the value that unlocks the achievement (int, double, or bool).
  • adopt (object Ajo)

    Wraps an existing Achievement AussomJavaObject.

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

    Returns the achievement name.

    • @r A string.
  • getDescription ()

    Returns the unlock description.

    • @r A string.
  • getVarName ()

    Returns the watched world-property name.

    • @r A string.
  • isAchieved ()

    Returns whether the achievement has been unlocked.

    • @r A bool.
  • achievedProperty ()

    Returns the achieved JavaFX ReadOnlyBooleanProperty for binding to UI.

    • @r An AussomJavaObject around a ReadOnlyBooleanProperty.
  • getVarValue ()

    Returns the value that triggers this achievement. Useful for UI showing "X / target" style progress.

    • @r The trigger value (int, double, or bool).