Skip to content

Configuring the game

Maks edited this page Feb 4, 2019 · 7 revisions

Config

The file assets/scripts/config.lua is used by both the engine and gameplay scripts. It is a lua script executed before any other. Here's an example:

-- used by the engine
width  = 1920
height = 1200
startScene = 'assets/scripts/arena.lua'

-- custom
bulletSpeed = 30
levelRestartDelay = 2
players = {
    {
        color = {1, 0, 0},
        ai = 'assets/scripts/playerAI_A.lua'
    },
    {
        color = {0, 0, 1},
        ai = 'assets/scripts/playerAI_B.lua'
    }
}

When launched the engine will create a 1920x1200 window and start the scene defined by the script assets/scripts/arena.lua. The full list of names used by the engine can be found below.

Custom scripts may access the configuration values through the global table called Config:

print(Config.width)         -- 1920
print(Config.bulletSpeed)   -- 30
print(Config.players[1].ai) -- assets/scripts/playerAI_B.lua
Clone this wiki locally