LunaLua events

From Moondust Wiki
Revision as of 18:15, 17 October 2014 by Kevsoft (talk | contribs)
Jump to navigation Jump to search
Events
Function Return values Description
onLoad() nil onLoad is called when the level editor or the game engine loads the level.
onLoop() nil On each frame while the game runs onLoop is called.
onLoopSection#(int playerIndex) nil On each frame while the game runs in the specific section # onLoopSection# is called. Replace # with the sectionnumber 0-20. Note: This function is called per player. If you are in 2-player-mode this function is called twice!
onLoadSection(int playerIndex) nil In the first frameloop of a new section onLoadSection is called. Note: This function is called per player. If you are in 2-player-mode this function is called twice!
onLoadSection#(int playerIndex) nil In the first frameloop of section # onLoadSection# is called. Replace # with the sectionnumber 0-20. Note: This function is called per player. If you are in 2-player-mode this function is called twice!
onJump(int playerIndex) nil When the player starts to jump, onJump is called. playerIndex is the index of the player (Player 1: playerIndex = 1; Player 2: playerIndex = 2).
onJumpEnd(int playerIndex) nil When the player hits the surface (jump ends), onJumpEnd is called. playerIndex is the index of the player (Player 1: playerIndex = 1; Player 2: playerIndex = 2).
onKeyDown(int keycode, int playerIndex) nil When a key is getting hit, onKeyDown is called. Keycode can be compared with the constants. playerIndex is the index of the player (Player 1: playerIndex = 1; Player 2: playerIndex = 2).
onKeyUp(int keycode, int playerIndex) nil When a key is getting released, onKeyUp is called. Keycode can be compared with the constants. playerIndex is the index of the player (Player 1: playerIndex = 1; Player 2: playerIndex = 2).