Change Map Example Added
A new map called "09-Change Map.map" has been added to the example game. This demonstrates how to use the new TriggerChangeMap.lua script to make your player progress from one level to the next.
In order to use this script, you must update your project with the new executables. Select the File > Project Manager menu to open the Project Manager, then press the "Update" button to update your project.
A new chunk of code has been added to App.lua to handle map changes. This code will be found in the main loop of the new App.lua script:
--Handle map change
if changemapname~=nil then
--Clear all entities
self.world:Clear()
--Load the next map
Time:Pause()
if Map:Load("Maps/"..changemapname..".map")==false then return false end
collectgarbage()
Time:Resume()
changemapname = nil
end
Using the TriggerChangeMap script is easy. Just attach it to a CSG brush and set the name of the next map you want to load, without the path or file extension. For example, to load the map "Maps/09-Change Map.map" you just type in "09-Change Map" in the "Map Name" field. When the player collides with the brush, the new map will be loaded. You can make the brush a panel on the floor, or an invisible trigger field.
You must opt into the beta branch on Steam to get these changes.
- 5
13 Comments
Recommended Comments