Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: MiniGameService

[19:7] extends: EngineService

Wraps FXGL's MiniGameService (com.almasb.fxgl.minigames.MiniGameService), the engine service that hosts a minigame inside its own SubScene (or, with the InGame variants, directly in the GameScene). Reach it at runtime via fxgl.getMiniGameService(). Each startXxx method pushes a new subscene and fires the Aussom callback (wrapped as a Consumer) once the minigame completes.

Methods

  • MiniGameService (Ajo = null)

    Creates a MiniGameService wrapper. Empty by default; use adopt to wrap the running engine's instance.

    • @p Ajo is an optional AussomJavaObject around a MiniGameService.
  • adopt (object Ajo)

    Wraps an existing MiniGameService AussomJavaObject.

    • @p Ajo is an AussomJavaObject around a MiniGameService.
    • @r A new wrapper.
  • startRandomOccurrence (double SuccessChance, callback Cb)

    Starts the RandomOccurrence minigame with the given success chance and fires the callback with a RandomOccurrenceResult AJO when the minigame finishes.

    • @p SuccessChance is a double in [0, 1].
    • @p Cb is a callback(resultAjo) -> void.
    • @r this object
  • startTriggerSequence (KeyCodesList, double WinRatio, callback Cb)

    Starts the TriggerSequence minigame with the given list of KeyTrigger keys (KeyCode AJOs) and the win ratio in [0, 1]. The callback receives a TriggerSequenceResult AJO.

    • @p KeyCodesList is an Aussom list of AussomJavaObjects around KeyCode values.
    • @p WinRatio is a double in [0, 1].
    • @p Cb is a callback(resultAjo) -> void.
    • @r this object
  • startSweetSpot (int SuccessRange, callback Cb)

    Starts the SweetSpot minigame with the given success-range width (in [0, 100]). The callback receives a SweetSpotResult AJO.

    • @p SuccessRange is an int in [0, 100].
    • @p Cb is a callback(resultAjo) -> void.
    • @r this object
  • startTriggerMash (object KeyTriggerObj, callback Cb)

    Starts the TriggerMash minigame for the given KeyTrigger (default boost 1.7, decay 0.1). The callback receives a TriggerMashResult AJO.

    • @p KeyTriggerObj is a KeyTrigger AussomJavaObject.
    • @p Cb is a callback(resultAjo) -> void.
    • @r this object
  • startTriggerMashTuned (object KeyTriggerObj, double BoostRate, double DecayRate, callback Cb)

    Starts the TriggerMash minigame for the given KeyTrigger with custom boost and decay rates. The callback receives a TriggerMashResult AJO.

    • @p KeyTriggerObj is a KeyTrigger AussomJavaObject.
    • @p BoostRate is a double (how fast the bar fills per successful press).
    • @p DecayRate is a double (how fast the bar drains).
    • @p Cb is a callback(resultAjo) -> void.
    • @r this object
  • startLockPicking (callback Cb)

    Starts the LockPick minigame. The callback receives a LockPickResult AJO.

    • @p Cb is a callback(resultAjo) -> void.
    • @r this object
  • startCircuitBreaker (int NumHorizontalTiles, int NumVerticalTiles, double PlayerSize, double PlayerSpeed, double MiniGameDelaySeconds, callback Cb)

    Starts the CircuitBreaker minigame with the supplied maze dimensions, player size and speed, and initial delay (seconds). The callback receives a CircuitBreakerResult AJO.

    • @p NumHorizontalTiles is the maze width in tiles.
    • @p NumVerticalTiles is the maze height in tiles.
    • @p PlayerSize is the player size in pixels.
    • @p PlayerSpeed is the player speed in pixels / second.
    • @p MiniGameDelaySeconds is the initial delay before play begins, in seconds.
    • @p Cb is a callback(resultAjo) -> void.
    • @r this object
  • startMiniGame (object ViewObj, callback Cb)

    Starts an arbitrary MiniGame backed by the supplied MiniGameView. The callback receives the resulting MiniGameResult AJO.

    • @p ViewObj is a MiniGameView (or subclass) wrapper.
    • @p Cb is a callback(resultAjo) -> void.
    • @r this object
  • startMiniGameInGame (object ViewObj, callback Cb)

    Like startMiniGame but plays the minigame directly in the GameScene rather than pushing a SubScene.

    • @p ViewObj is a MiniGameView (or subclass) wrapper.
    • @p Cb is a callback(resultAjo) -> void.
    • @r this object