Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: InstantAction

[29:7] extends: Action

Wraps FXGL's InstantAction abstract class (com.almasb.fxgl.entity.action.InstantAction). The engine calls performOnce(tpf) the first frame the action becomes current and then auto-completes; useful for one-shot behaviors (fire weapon, open door, play sound). Backed by AussomInstantAction (Java bridge) because the class has overridable performOnce plus the four Action lifecycle hooks. Example: public fire(tpf) { // run once then done } ia = new InstantAction(::fire); ac.addAction(ia.obj);

Methods

  • InstantAction (callback OnPerformOnce = null, callback OnQueued = null, callback OnStarted = null, callback OnCompleted = null, callback OnCancelled = null)

    Creates a new InstantAction.

    • @p OnPerformOnce is a callback (tpf) -> any fired the first frame this action becomes current.
    • @p OnQueued is a callback () -> any.
    • @p OnStarted is a callback () -> any.
    • @p OnCompleted is a callback () -> any.
    • @p OnCancelled is a callback () -> any.
  • adopt (object Ajo)

    Wraps an existing InstantAction AussomJavaObject.