At some point, it's better to just put the code out there in its current state than keep sitting on them, right? So, as I did with the Terraria NPC pack, here's three lua libraries I'm releasing in their current state! I'll post more whenever they happen.
Everything in this thread comes as-is with no guarantees of support or updates, but they worked the last time I checked and if there are any issues they shouldn't need much work to fix up. And if someone wants to finish and package up any of these as proper releases, go for it!
shuffledQueues.lua
A library for managing randomly-shuffled lists with additional handling for avoiding repeated values. Good for boss attack queues, card decks... I guess if you want to make a roguelike in SMBX you could use it for that too?
cgfxBridge.lua
You know how you can use a folders.ini file to tell the editor which subfolders your episode's custom graphics and config files are in? Well, you can override that file for individual levels. Doing so can make assets show up properly in the editor even if they're not in the level's resource folder, but those graphics and configs still won't be applied when playing the level.
cgfxBridge fixes that to an extent by comparing the episode and level folders.ini files, loading images and txt files from any unique paths listed, and applying them to Graphics.sprites.npc, Block.config, etc. This means that if you have a tileset you'll be using in multiple levels but don't want to make all of those assets episode-wide resprites, you can just store them in one place and have those levels share them! As of version 0.4, it also supports replacements for SMBX 1.3 sound effects (the ones in this list here.)
Note that this only changes things on the in-game side, the current limits of folders.ini still apply within the editor; you'll still need to include, for example, copies of any custom tileset inis in the level's resource folder.
Here's the older version 0.3.5 if you want that for whatever reason.
customAssetHelper.lua
Say you want to set up a type of custom asset used in your episode, like hats or inventory items. You could just store the assets' data as hardcoded nested tables, but you'd prefer to set it up within SMBX's file-and-folder workflow so that things are a bit more collaboration-friendly.
This library lets you define custom asset types that work similarly to costumes, with each asset of that type getting its own folder and specific files to check for within that folder; so, for example, your episode might look something like this:
- ExampleEpisode
- danielcraig
- danielcraig.png
- luna.lua
- danielcraig.lvlx
- FINALBOSS
- FINALBOSS.lvlx
- hats
- ribbon
- config.json
- above.png
- below.png
- icon.png
- beret
- config.json
- above.png
- below.png
- icon.png
- aviator
- config.json
- above.png
- below.png
- icon.png
- ribbon
- luna.lua
- danielcraig
Then in your code you can do this:
Code: Select all
local customAssetHelper = require("customAssetHelper")
local hatData = customAssetHelper.importAssets{
folder = "hats",
prefix = "Hat",
images = {"above","below","icon"}
}
function onStart()
Misc.dialog(HAT_AVIATOR, HAT_RIBBON, "", hatData)
end
Someone on Discord asked for help with making a sound test, so I threw together this library from the one I made for Delightful Enhanced.
Here's footage of the original in action, which doesn't want to work with the youtube tag for some reason.