There are several settable options for your level that you can choose to turn on or off according to your needs.
All of these functions need to be in your Gameflow.lua
level block.
Further functions can be found at the TombEngine Lua API Documentation
Ambient Track #
Initial ambient sound track to play. This is the filename of the track without the .wav extension.
level.ambientTrack = "110"
Cloud Layers #
Displays a layer of clouds at the top of the sky. Uses the SKY_GRAPHICS sprites.
You can have two layers that are independent of one another.
- r = red value (0-255)
- g = green value (0-255)
- b = blue value (0-255)
- speed: cloud speed (-32768 to 32767)
- Usage tip is to keep your values small.
level.layer1 = Flow.SkyLayer(Color.new(r,g,b),speed)
level.layer2 = Flow.SkyLayer(Color.new(r,g,b),speed)
Distance Fog #
Distance fog can be applied in your level using the below code:
- r = red value (0-255)
- g = green value (0-255)
- b = blue value (0-255)
- startDist: the distance (in sectors) from the camera the effect starts.
- endDist: the distance (in sectors) the effect becomes completely opaque.
level.fog = Flow.Fog(Color(r,g,b), startDist,endDist)
Global Lensflare #
Available in a forthcoming update.
Adds a customisable global lens flare. The lensflare is setup by defining two angles (pitch and yaw) and the colour.
To change the sun / moon sprite: replace sprite 31 in the DEFAULT_SPRITES.
- pitch = angle going across the X axis from left to right (in degrees).
- yaw = angle going across the Y axis from top to bottom (in degrees).
- r = red value (0-255)
- g = green value (0-255)
- b = blue value (0-255)
level.lensFlare = Flow.LensFlare(pitch,yaw,Color(r,g,b))
Level Data File #
Compiled file path. This path is relative to the location of the TombEngine executable.level.levelFile = "Data\\newLevel.ten"
Level Script #
Level-specific Lua script file. Path of the Lua file holding the level’s logic script, relative to the location of the TombEngine executablelevel.scriptFile = "Scripts\\Levels\\newLevel.lua"
Reset Hub #
Resets the state for all previous levels, including items, flipmaps and statistics.
level.resetHub = true
Rumble #
Occasionally shakes the screen and plays soundID 359 (TR4_ENVIORONMENT_RUMBLE).
level.rumble = true
Secret Count #
Sets the amount of secrets in a particular level.
level.secrets = numberofSecrets
Starry Sky #
Available in a forthcoming update.
Adds a customisable starry sky.
This effect can contain a mix of twinkling stars and shooting meteors with settable parameters:
- starCount = Total amount of stars. (Maximum 6000)
- meteorCount = Total amount of meteors (Maximum 100)
- meteorSpawnRate = Chance of engine rendering the meteors.
- meteorVelocity = Controls how fast the meteors travel.
level.starfield = Flow.Starfield(starCount, meteorCount, meteorSpawnRate, meteorVelocity)
Thunder Storm #
Lights up the sky and plays soundID 182 (SFX_TR4_THUNDER_RUMBLE) occasionally.
level.storm = true
Weather Effects #
You must choose a weather type first:
level.weather = WeatherType.Rain
level.weather = WeatherType.Snow
To set the strength: use the below code and set “float” to any value between 0.1 and 1.0
level.weatherStrength = float
To ensure your level is displaying the weather: you must check the “Wind” checkbox in Tomb Editor for each room
Young Lara #
Enables the formative version of Lara Croft found at the start of Tomb Raider 4 or in Ireland in TR5.
Unlike other engines: Young Lara can use weapons and vehicles if desired and there are no restrictions on her usage. It is now simple a cosmetic change that will render two ponytails instead of the single braid.
level.laraType = LaraType.Young