This post is just for seeking general info about level management. I’m working on a platform game, and right now I’m outlining a general scheme for a level management system (select level, load resources, unload resources) what I have right now is a couple of files describing some tables for level geometry (collision paths), some helper functions, and resources instances.
The first file is just pretty much a collection of tables and functions, it is something like this:
Code: Select all
--File: level0-A.lua
level0 = {}
local levelGeometry = {some stuff…}
function level0:someFunction()
stuff…
end
…
Code: Select all
--File: level0-B.lua
level = class:new()
function level:init()
--Load level images
--Load level resources (enemies, platforms)
end
function level:update()
--update level state
end
function level:draw()
--draw all images
end
What I’m thinking right off the bat is to merge all my level stuff in a one file, structured as a class, eventually I’ll end up with n level files and I could require them with a state machine-like structure in my main game file, but I honestly haven’t tested that idea yet and I’m unsure of its effectiveness. What do you think?
If you’ve got any suggestions for me, please feel free to comment! Thanks for your time