I've thrown together a tool that lets me build pico-8 games using multiple files, and include them with an @import "something" syntax.
Wanted to share this with folks here, but after I built it I thought to myself.. what if its is baked in and I just missed it? :O
Heres what this tool allows for:
Inside my carts folder I have a folder called apps, with a folder for each project
The folder structure for mygame, and code is as follows
@import "foo" @import "bar" print("hello from _main.lua!")
print("hello from foo.lua!")
print("hello from bar.lua!")
The tool replaces any @import statement with the contents of the file mentioned.
It watches for changes across any file in the mygame directory
replaces the __lua__ portion of the mygame.p8 file with the resulting code, and rebuilds mygame.p8
print("hello from _main.lua!") print("hello from foo.lua!") print("hello from bar.lua!")
You still use the sprite, map, sfx, and music tabs of PICO-8, but you have to forfeit the code tab and use an external editor. I use Sublime Text 3.
Let me know if I've totally reinvented the wheel on this, or if you guys are interested in helping me test/distribute this :)