Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: GameScene

[14:7] extends: FXGLScene

Wraps FXGL's GameScene, the active scene during gameplay. Hosts the game world's entity views plus a separate UI root for HUD elements added through addUINode. Reached at runtime via fxgl.getGameScene (chunk 6); obtain a wrapper via adopt.

Methods

  • GameScene (Ajo = null)

    Creates a GameScene wrapper. The default form is empty (used by adopt); the (Ajo) form wraps an existing GameScene from fxgl.getGameScene.

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

    Wraps an existing GameScene AussomJavaObject.

    • @p Ajo is an AussomJavaObject around a GameScene.
    • @r A new wrapper.
  • addUINode (object NodeObj)

    Adds a JavaFX Node to the UI overlay (in front of the game world). Use for HUD elements, score readouts, etc.

    • @p NodeObj is a wrapper exposing the node via .obj.
    • @r this object
  • removeUINode (object NodeObj)

    Removes a node previously added via addUINode.

    • @p NodeObj is a wrapper exposing the node via .obj.
    • @r A bool, true if removed.
  • setUIMouseTransparent (bool Transparent)

    Sets whether UI nodes ignore mouse events (pass-through).

    • @p Transparent is a bool.
    • @r this object
  • clearUINodes ()

    Clears every UI node added through addUINode.

    • @r this object
  • getGameWorld ()

    Returns the scene's GameWorld as an AussomJavaObject (typically reached via fxgl.getGameWorld instead).

    • @r An AussomJavaObject around the GameWorld.
  • getPhysicsWorld ()

    Returns the scene's PhysicsWorld as an AussomJavaObject.

    • @r An AussomJavaObject around the PhysicsWorld.
  • getUINodes ()

    Returns the unmodifiable list of UI nodes currently added to the scene.

    • @r An AussomJavaObject around an ObservableList.
  • clearGameViews ()

    Drops every view registered on the game layer.

    • @r this object
  • getCamera3D ()

    Returns the 3D camera as an AussomJavaObject. Only useful when GameSettings.setIs3D(true) was used at launch.

    • @r An AussomJavaObject around the Camera3D.
  • setMouseGrabbed (bool Grabbed)

    Sets whether the mouse cursor is grabbed (locked and hidden in FPS-style games).

    • @p Grabbed is a bool.
    • @r this object
  • isMouseGrabbed ()

    Returns whether the mouse is currently grabbed.

    • @r A bool.
  • setFPSCamera (bool Enabled)

    Sets whether the 3D camera operates in FPS mouse-look mode.

    • @p Enabled is a bool.
    • @r this object
  • isFPSCamera ()

    Returns whether the 3D camera is in FPS mouse-look mode.

    • @r A bool.
  • setSingleStep (bool Enabled)

    Sets whether the game loop advances only on explicit step() calls.

    • @p Enabled is a bool.
    • @r this object
  • isSingleStep ()

    Returns whether single-step mode is enabled.

    • @r A bool.
  • step (double Tpf)

    Drives the game scene forward by tpf seconds when single-step mode is enabled.

    • @p Tpf is the elapsed time in seconds.
    • @r this object
  • addUINodes (list Nodes)

    Adds multiple UI nodes in one call. Accepts an Aussom list of fx.Node wrappers or raw Node AJOs.

  • removeUINodes (list Nodes)

    Removes multiple UI nodes in one call.

  • addUI (object UIObj)

    Attaches a fxgl.UI wrapper (root + controller pair) to the scene.

  • removeUI (object UIObj)

    Detaches a previously added UI from the scene.

  • addGameView (object GameViewAjo)

    Adds a GameView (z-ordered renderable) to the scene.

  • removeGameView (object GameViewAjo)

    Removes a GameView from the scene.

  • onEntityAdded (object EntityObj)

    Lifecycle hook: called when an entity is added to the world.

  • onEntityRemoved (object EntityObj)

    Lifecycle hook: called when an entity is removed from the world.

  • onEnteredFrom (object PrevSceneAjo)

    Scene-transition hook: called when entering from PrevScene.

  • onExitingTo (object NextSceneAjo)

    Scene-transition hook: called when exiting to NextScene.