Nocturna
    Preparing search index...

    GameScene manages the main singleplayer gameplay loop in Nocturna.

    Responsibilities:

    • Loads and initializes the level, cube, parent node, and player.
    • Handles the main game loop, including state transitions (loading, selection, in-game).
    • Manages all game objects, their updates, and collisions.
    • Sets up cameras (multiple FollowCameras) and allows switching between them.
    • Handles score calculation with time-based multipliers.
    • Manages the HUD (health bar, timer, etc.) and background music.
    • Observes and reacts to collisions (coins, enemies, victory, etc.).
    • Supports restarting, retrying, and quitting the level.
    • Implements interfaces for level loading, object observation, collision, and HUD events.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    activeCameraIndex: number = 0
    cameras: FollowCamera[] = []
    cube: Cube
    engine: Engine

    The Babylon.js engine instance.

    gameObjects: GameObject[] = []
    hpBar: HpBar
    inputHandler: InputHandler

    Handles user input for the scene.

    levelLoader: LevelLoader
    multiplicators: number[] = ...
    parent: ParentNode
    player: Player
    scene: Scene

    The Babylon.js scene instance.

    sceneName: string = "tutorial.json"
    score: number = 0
    timeMultiplicator: number = ...
    timer: number = 0
    win: boolean = false
    sceneIndex: number = 0
    sceneOrder: string[] = ...

    Methods

    • Initializes Havok physics for the scene with high gravity and a fixed timestep. Should be called asynchronously.

      Returns Promise<void>

    • Handles collision with the bottom of the cube (player death).

      Parameters

      • collider: PhysicsBody

        The PhysicsBody that collided.

      Returns void

    • Main update loop for the scene. Handles state transitions.

      Parameters

      • dt: number

        Delta time since last update.

      Returns void