Callback events called by engine.
There are must be defined in your script files where you want to handle those 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)|
- onInitEngine ()
Event callback once called on Lua engine initialization
function onInitEngine() -- Initialize your stuff if needed here end
- onLoop (frameDelay)
Event callback calling per every frame
- frameDelay double Frame delay in milliseconds. Use it for various timing processors.
-- 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)
- camera LevelCommon.LevelCamera Camera where need to show HUD
- playerState LevelCommon.LevelPlayerState State of playable character
function onDrawHUD(camera, state) -- Write here your code to draw HUD based on given or any other information end