Skyline Lua API  Version 1.0
Lua Script Reference for Skyline Game Engine.
state Class Reference

#include <LUA_API_States.h>

Public Member Functions

void setGameState (int stateID)
 Set the current game state in the game. This means swap between the predefined states such as Main game, paused, game over, game win and game start. Or switching to the other user controllable states. More...
 
int getGameState ()
 Call this function to return the current Game State. More...
 
void setGamePaused ()
 Call this function to set the current game state to Paused. No params required. More...
 
void setGameMain ()
 Call this function to set the current game state to Main state which is default. No params required. More...
 
void setGameStart ()
 Call this function to set the current game state to Game Start. No params required. More...
 
void setGameOver ()
 Call this function to set the current game state to Game Over. No params required. More...
 
void setGameWin ()
 Call this function to set the current game state to GameWin. No params required. More...
 
void setGameUser1 ()
 Call this function to set the current game state to User State 1. No params required. More...
 
void setGameUser2 ()
 Call this function to set the current game state to User State 2. No params required. More...
 
void setGameUser3 ()
 Call this function to set the current game state to User State 3. No params required. More...
 
void setGameUser4 ()
 Call this function to set the current game state to User State 4. No params required. More...
 
void setGameUser5 ()
 Call this function to set the current game state to User State 5. No params required. More...
 
void setGameUser6 ()
 Call this function to set the current game state to User State 6. No params required. More...
 
void setGameUser7 ()
 Call this function to set the current game state to User State 7. No params required. More...
 
void setGameUser8 ()
 Call this function to set the current game state to User State 8. No params required. More...
 
void setGameUser9 ()
 Call this function to set the current game state to User State 9. No params required. More...
 
void setGameUser10 ()
 Call this function to set the current game state to User State 10. No params required. More...
 
void routeStatePath (int stateID)
 Reroute how the user states update during the game. This is useful if you want the game to freeze in the update loops so no physics or effects update. Essentially you can choose whether your user states run through the main game state update or the pause game state update to control better how your states work for you. More...
 

Detailed Description

This area covers state functions. Set and control the current game states that the system is running with.
Use as state.function()
For more information on how these functions can be used please visit the User Manual - http://www.aurasoft-skyline.co.uk

Member Function Documentation

int state::getGameState ( )

Call this function to return the current Game State.

Returns
The current Game State.

The following is a Small Example on how to use this function:

function onInit(objID)
    curentState = sky.getGameState();
end
void state::routeStatePath ( int  stateID)

Reroute how the user states update during the game. This is useful if you want the game to freeze in the update loops so no physics or effects update. Essentially you can choose whether your user states run through the main game state update or the pause game state update to control better how your states work for you.

For example, a user state may be used to force a GUI on screen that does something and when closed the game resumes, or the user state may want to switch how characters are moving or behaving which would use the main state for updating and the former would use the pause state for updating.

However, the function for your user state update remain the same with the engine triggering the lua to onUpdate_User1() instead of triggering the main or pause game update loops.

This allows an infinite way of mapping how a state should and can run with reusing code from other states as the pause state will only update scripts and no actions for instance, whereas the main game state will update all things as normal.

This is considered an advanced feature.

Parameters
Thestate id you wish to copy.

So far only, enum.GS_GameMain() and enum.GS_GamePaused() are used.

The following is a Small Example on how to use this function:

function onKetDown(key)
    if(key == "0")then
        -- | Set the current User state between 1-10
        state.setGameUser1();

        -- | Force to use a simpler update that will freeze most things from running apart
        -- | from scripts and microscripts. Everything else wont move.
        state.routeStatePath( enum.GS_GamePaused() ); 
    end
end

function onKetDown_User1(key)
    if(key == "9")then
    -- | Set the current User state between 1-10
    state.setGameMain();

    -- | Reroute the system back through the main state again for future user
    -- | state workings. The 5 main states dont use this, only the user states do.
    -- | but it is always good to reset things.
    state.routeStatePath( enum.GS_GameMain() );
    end
end
void state::setGameMain ( )

Call this function to set the current game state to Main state which is default. No params required.

The following is a Small Example on how to use this function:

function onInit(objID)
state.setGameMain();
end
void state::setGameOver ( )

Call this function to set the current game state to Game Over. No params required.

The following is a Small Example on how to use this function:

function onInit(objID)
    state.setGameOver();
end
void state::setGamePaused ( )

Call this function to set the current game state to Paused. No params required.

The following is a Small Example on how to use this function:

function onInit(objID)
    state.setGamePaused();
end
void state::setGameStart ( )

Call this function to set the current game state to Game Start. No params required.

The following is a Small Example on how to use this function:

function onInit(objID)
state.setGameStart();
end
void state::setGameState ( int  stateID)

Set the current game state in the game. This means swap between the predefined states such as Main game, paused, game over, game win and game start. Or switching to the other user controllable states.

Parameters
gameState:An integer representing the state to be changed to.

The currently available Game States are as follows:

1 = GS_GAMEMAIN
2 = GS_GAMEPAUSED
3 = GS_GAMESTART
4 = GS_GAMEOVER
5 = GS_GAMEWIN
6 = GS_GAMEUSER1
7 = GS_GAMEUSER2
8 = GS_GAMEUSER3
9 = GS_GAMEUSER4
10 = GS_GAMEUSER5
11 = GS_GAMEUSER6
12 = GS_GAMEUSER7
13 = GS_GAMEUSER8
14 = GS_GAMEUSER9
15 = GS_GAMEUSER10
Also see enum.GS_GameMain(), enum.GS_GamePaused() etc.. to return you the correct int id for the state. to switch state and not need the index then see. state.setGameMain(), state.setGamePaused(), etc...

Here is a Small Example of how to use this function:

function onInit(objID)
    sky.setGameState(enum.GS_GamePaused());
end
void state::setGameUser1 ( )

Call this function to set the current game state to User State 1. No params required.

The following is a Small Example on how to use this function:

function onInit(objID)
    state.setGameUser1();
end
void state::setGameUser10 ( )

Call this function to set the current game state to User State 10. No params required.

The following is a Small Example on how to use this function:

function onInit(objID)
state.setGameUser10();
end
void state::setGameUser2 ( )

Call this function to set the current game state to User State 2. No params required.

The following is a Small Example on how to use this function:

function onInit(objID)
state.setGameUser2();
end
void state::setGameUser3 ( )

Call this function to set the current game state to User State 3. No params required.

The following is a Small Example on how to use this function:

function onInit(objID)
state.setGameUser3();
end
void state::setGameUser4 ( )

Call this function to set the current game state to User State 4. No params required.

The following is a Small Example on how to use this function:

function onInit(objID)
state.setGameUser4();
end
void state::setGameUser5 ( )

Call this function to set the current game state to User State 5. No params required.

The following is a Small Example on how to use this function:

function onInit(objID)
state.setGameUser5();
end
void state::setGameUser6 ( )

Call this function to set the current game state to User State 6. No params required.

The following is a Small Example on how to use this function:

function onInit(objID)
state.setGameUser6();
end
void state::setGameUser7 ( )

Call this function to set the current game state to User State 7. No params required.

The following is a Small Example on how to use this function:

function onInit(objID)
state.setGameUser7();
end
void state::setGameUser8 ( )

Call this function to set the current game state to User State 8. No params required.

The following is a Small Example on how to use this function:

function onInit(objID)
state.setGameUser8();
end
void state::setGameUser9 ( )

Call this function to set the current game state to User State 9. No params required.

The following is a Small Example on how to use this function:

function onInit(objID)
state.setGameUser9();
end
void state::setGameWin ( )

Call this function to set the current game state to GameWin. No params required.

The following is a Small Example on how to use this function:

function onInit(objID)
    state.setGameWin();
end

The documentation for this class was generated from the following file: