OK, Right now I have only 'void main()' in as script, from where I am calling the registered functions. But it is called only once during the initialization of the game.
After loading and initialing the game, I need to call some functions to update the object properties (like positions, rotations, moving objects, events etc) continuously, for which I need to register a script function like 'void main().
Example of a script will look something like this -
const Object @hero;
const Object @enemy;
// init the game
@hero = findObject("hero");
@enemy = findObject("enemy");
// some other functions
// update the game loop
void update(float dt)
forward = forward + 1 * dt;
hero.setPosition(0, 0, forward);
// other functions
Anything inside 'void update()' should loop continuously to move the hero object. I am just a little bit confused, how to register the 'void update'.
Sorry for the short explanation. Actually I have already implemented AS which is working fine. What I want to know is - I want to register a GetFunctionByDecl, which will be used for the game loop. like the "void main()". Where all game update functions will be called. like
void Update(float dt)
// Other calls
This function should be called continuously from the game loop to update the position of the object. How and where to register it?