Module EventCallbacks

Callback events called by engine.

There are must be defined in your script files where you want to handle those events.

Global events

onInitEngine () Event callback once called on Lua engine initialization
onLoop (frameDelay) Event callback calling per every frame
onDrawHUD (camera, playerState) Event callback calling per every frame after all in-game objects are drawn (Levels Only)


Global events

onInitEngine ()
Event callback once called on Lua engine initialization

Usage:

    function onInitEngine()
        -- Initialize your stuff if needed here
    end
onLoop (frameDelay)
Event callback calling per every frame

Parameters:

  • frameDelay double Frame delay in milliseconds. Use it for various timing processors.

Usage:

    -- A timer value
    local timer = 0
    
    -- Play sound every one second
    function ticker(frameDelay)
        -- Iterate a timer
        timer = timer + frameDelay
        -- Check if timer reaches one whole second
        if(timer >= 1000)then
            -- Play a tick sound
            Audio.playSoundByRole(SoundRoles.MenuScroll)
            -- Reset timer to zero without lost of timing accuracy
            timer = timer - 1000
        end
    end
    
    function onLoop(frameDelay)
        ticker(frameDelay)
    end
onDrawHUD (camera, playerState)
Event callback calling per every frame after all in-game objects are drawn (Levels Only)

Parameters:

Usage:

    function onDrawHUD(camera, state)
        -- Write here your code to draw HUD based on given or any other information
    end
generated by LDoc 1.4.6 Last updated 2017-08-21 02:20:32