Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: RechargeableIntComponent

[20:7] extends: IntegerComponent

Wraps FXGL's RechargeableIntComponent (com.almasb.fxgl.dsl.components.RechargeableIntComponent), the abstract base for any rechargeable int-valued resource. Subclasses include HealthIntComponent and ManaIntComponent. This wrapper is abstract; construct one of the concrete subclasses, then optionally rewrap with adopt() if you want the base API.

Methods

  • RechargeableIntComponent ()

    Empty default constructor; populate with adopt().

  • adopt (object Ajo)

    Wraps an existing RechargeableIntComponent AussomJavaObject.

  • getValue ()

    Returns the current value (int).

  • setValue (int V)

    Sets the value. Internally clamped to [0..maxValue].

    • @p V is the new value.
    • @r this object
  • valueProperty ()

    Returns the IntegerProperty for value (binding-friendly).

  • getMaxValue ()

    Returns the max value (int).

  • setMaxValue (int V)

    Sets the max value. Current value is re-clamped if it exceeds the new max.

    • @p V is the new max value.
    • @r this object
  • maxValueProperty ()

    Returns the max-value IntegerProperty.

  • getValuePercent ()

    Returns the value as a percentage of max (0..100, double).

  • valuePercentProperty ()

    Returns the percent binding.

  • damageFully ()

    Sets value to 0.

  • damage (int Amount)

    Reduces value by the given amount (clamped to 0).

    • @p Amount is the damage amount.
    • @r this object
  • damagePercentageCurrent (double Percentage)

    Damages by a percentage of current value.

    • @p Percentage is the percent of current value in 0..100.
    • @r this object
  • damagePercentageMax (double Percentage)

    Damages by a percentage of max value.

    • @p Percentage is the percent of max value in 0..100.
    • @r this object
  • restoreFully ()

    Restores value to max.

  • restore (int Amount)

    Restores by the given amount (clamped to max).

    • @p Amount is the restore amount.
    • @r this object
  • restorePercentageCurrent (double Percentage)

    Restores by a percentage of current value.

    • @p Percentage is the percent of current value in 0..100.
    • @r this object
  • restorePercentageMax (double Percentage)

    Restores by a percentage of max value.

    • @p Percentage is the percent of max value in 0..100.
    • @r this object
  • isZero ()

    True iff value is at or below zero.

  • zeroProperty ()

    Returns the BooleanBinding that fires true when value is 0.