Krig Game Engine Lua Scripting API - Game Level.  
More...
|  | 
| void | load (string) | 
|  | 
| void | load_from_buffer (string) | 
|  | 
| void | pause () | 
|  | 
| int | get_id () | 
|  | 
| int | set_id (int) | 
|  | 
| void | swap () | 
|  | 
| bool | get_complete () | 
|  | 
| void | set_complete (bool) | 
|  | 
| void | play_music (string, int) | 
|  | 
| void | stop_music () | 
|  | 
| void | pause_music () | 
|  | 
| void | set_sky_box (float, float, float, float, float, float, float, float, float) | 
|  | 
| Vector | get_light_direction () | 
|  | 
| void | set_light_direction (Vector) | 
|  | 
| void | set_light_direction (float, float, float) | 
|  | 
| void | set_terrain (TerrainObjectReference, string) | 
|  | 
| int | get_camera_id () | 
|  | 
| GameObjectReference | find_object_of_type (int) | 
|  | 
| GameObjectReference | add_object (string, options) | 
|  | 
| void | remove_object (GameObjectReference) | 
|  | 
| TextObjectReference | add_text (string, string, options) | 
|  | 
| TextObjectReference | add_sprite (string, options) | 
|  | 
| int | luaopen_krigLevel (lua_State *L) | 
|  | 
Krig Game Engine Lua Scripting API - Game Level. 
Game level API functionality. 
◆ add_object()
      
        
          | GameObjectReference add_object | ( | string | , | 
        
          |  |  | options |  | 
        
          |  | ) |  |  | 
      
 
Add a game object to the current level. 
- Parameters
- 
  
    | string | - path to lua script for new game object to load. |  | table | - options table to be passed into the "on_load" method for the game object. |  
 
- Returns
- GameObjectReference 
 
 
◆ add_sprite()
      
        
          | TextObjectReference add_sprite | ( | string | , | 
        
          |  |  | options |  | 
        
          |  | ) |  |  | 
      
 
Add a 2D bitmapped game object to the current level. 
- Parameters
- 
  
    | string | - path to lua script for new object to load. |  | table | - options table to be passed into the "on_load" method for the object. |  
 
- Returns
- TextObjectReference 
 
 
◆ add_text()
      
        
          | TextObjectReference add_text | ( | string | , | 
        
          |  |  | string | , | 
        
          |  |  | options |  | 
        
          |  | ) |  |  | 
      
 
Add a game object to the current level. 
- Parameters
- 
  
    | string | - path to lua script for new text object to load. |  | string | - text. |  | table | - options table to be passed into the "on_load" method for the text object. |  
 
- Returns
- TextObjectReference 
 
 
◆ find_object_of_type()
      
        
          | GameObjectReference find_object_of_type | ( | int |  | ) |  | 
      
 
Query the engine for a game object of the specified type. 
- Parameters
- 
  
    | int | - ID of object type to find. |  
 
- Returns
- Vertex2 - x, y coordinate of the mouse. 
 
 
◆ get_camera_id()
A game level can use up to 4 cameras, each with its own independent attached script and settings. However, only one camera can be "active" at a time. This method returns the ID of the active camera. 
- Returns
- int ID of the active camera 
 
 
◆ get_complete()
Query the engine to determine if the present level has been marked complete. 
- Returns
- bool true if the level has been marked complete, false otherwise 
 
 
◆ get_id()
Query the engine to determine the ID of the present level. 
- Returns
- int the ID associated with the present game level. 
 
 
◆ get_light_direction()
      
        
          | Vector get_light_direction | ( |  | ) |  | 
      
 
Fetch the configured light direction. 
- Returns
- Vector 
 
 
◆ load()
Load the game level Lua script from the file specified. 
- Parameters
- 
  
    | string | name of the game level Lua script to load. |  
 
- Returns
- n/a 
 
 
◆ load_from_buffer()
      
        
          | void load_from_buffer | ( | string |  | ) |  | 
      
 
Load the game level Lua script from the supplied string buffer. 
- Parameters
- 
  
    | string | buffer containing a game level Lua script to load. |  
 
- Returns
- n/a 
 
 
◆ pause()
Pause execution of the game 
- Returns
- n/a 
 
 
◆ pause_music()
Pause song (if playing). Song will resume where it was paused when played. 
- Returns
- n/a 
 
 
◆ play_music()
      
        
          | void play_music | ( | string | , | 
        
          |  |  | int |  | 
        
          |  | ) |  |  | 
      
 
Playing song specified. 
- Parameters
- 
  
    | string | name of file containing the song to play. |  | int | repeat control (0 - do not repeat, 1 - repeat). |  
 
- Returns
- n/a 
 
 
◆ remove_object()
      
        
          | void remove_object | ( | GameObjectReference |  | ) |  | 
      
 
Remove the specified object from the level. 
- Parameters
- 
  
  
- Returns
- n/a 
 
 
◆ set_complete()
      
        
          | void set_complete | ( | bool |  | ) |  | 
      
 
The currently running game level maintains a state about whether it has been marked as "complete" or not. This method sets this state. 
- Parameters
- 
  
    | bool | true - level is marked as complete, false - level is not complete |  
 
- Returns
- n/a 
 
 
◆ set_id()
Set the ID associated with the present level. 
- Parameters
- 
  
  
- Returns
- n/a 
 
 
◆ set_light_direction() [1/2]
      
        
          | void set_light_direction | ( | Vector |  | ) |  | 
      
 
Set the light direction in the game level's scene. This setting affects shading on models and the terrain. 
- Parameters
- 
  
    | Vector | array containing x, y, z coordinates of the directed light vector |  
 
- Returns
- n/a 
 
 
◆ set_light_direction() [2/2]
      
        
          | void set_light_direction | ( | float | , | 
        
          |  |  | float | , | 
        
          |  |  | float |  | 
        
          |  | ) |  |  | 
      
 
Set the light direction in the game level's scene. This setting affects shading on models and the terrain. 
- Parameters
- 
  
    | float | x coordinate of the directed light vector |  | float | y coordinate of the directed light vector |  | float | z coordinate of the directed light vector |  
 
- Returns
- n/a 
 
 
◆ set_sky_box()
      
        
          | void set_sky_box | ( | float | , | 
        
          |  |  | float | , | 
        
          |  |  | float | , | 
        
          |  |  | float | , | 
        
          |  |  | float | , | 
        
          |  |  | float | , | 
        
          |  |  | float | , | 
        
          |  |  | float | , | 
        
          |  |  | float |  | 
        
          |  | ) |  |  | 
      
 
Render a sky box around the level using the three colors supplied. Color 1 is the top color; Color two is in the middle; Color 3 is the bottom color. 
- Parameters
- 
  
    | float | first color, red attribute (0.0 - 1.0) |  | float | first color, green attribute (0.0 - 1.0) |  | float | first color, blue attribute (0.0 - 1.0) |  | float | second color, red attribute (0.0 - 1.0) |  | float | second color, green attribute (0.0 - 1.0) |  | float | second color, blue attribute (0.0 - 1.0) |  | float | third color, red attribute (0.0 - 1.0) |  | float | third color, green attribute (0.0 - 1.0) |  | float | third color, blue attribute (0.0 - 1.0) |  
 
- Returns
- n/a 
 
 
◆ set_terrain()
      
        
          | void set_terrain | ( | TerrainObjectReference | , | 
        
          |  |  | string |  | 
        
          |  | ) |  |  | 
      
 
Set the specified level's terrain. 
- Parameters
- 
  
    | TerrainObjectReference |  |  | string | terrain file to load. |  
 
- Returns
- n/a 
 
 
◆ stop_music()
Stop playing song (if playing). Song will restart when played. 
- Returns
- n/a 
 
 
◆ swap()
TODO: Undefined 
- Returns
- n/a