This is the repository that collects everything you need to begin editing levels in Min Hero!
So far, it seems to work perfectly. But - as this is still in its infancy - if you get any errors, please contact me (info at bottom) or create a Github issue here!
The guide to do it:
First, it's recommended to have these installed:
- Inkscape (as the level editor)
- Python (to run encoder/decoder, and converter script)
- JPEXS Free Flash Decompiler (to modify the game files) (download here)
Also, this guide assumes that you are using Windows 10/11. This has not been tested on other systems, but there should be workarounds.
Here is how it works: (note that this is for a single room, for levels/multiple rooms, read the extra bit)
-
Pick the room that you want from the folder at this link
- "Eggery" -> The Hatchery
- "H#" -> Hallways
- "A-G" -> Rooms in a floor
-
Download either the
Source Code (zip)file and extract all, or the named files in Releases. -
Then, download all of the images in the
required_imagesfolder, these are the "building blocks" of the level editor, and it's adivsed to stick to them (unless you are a pro). -
Move the
xml_to_svg.pyfile and the room file from step 1 to the same folder asrequired_images -
Run
xml_to_svg.py. This can be done (if Python is installed) by opening the command prompt (right click option) and typing:python xml_to_svg.py, or you can use your preferred way to run Python files. There should be a file calleddone.svg.
- Open up
done.svgwith Inkscape (or other SVG editing application) by right clicking on the file, then "Open With...", then "Inkscape". - There are 3 layers in this SVG:
*
layer1-> A layer that stores all of the decor items (carpets, tables etc) *layer2-> A layer containing wall and floor tiles *layer3-> A layer that stores all non-visible but needed assets. This includes hitboxes, interaction ranges and triggers between rooms (like entrances)
To edit, just import new images with the import type as "link" into their respective layer, and scale/position/rotate to fit! A couple "pro tips" are listed below:
- Make sure to use the not-normally-visible sprites in
layer3to add functionality. This is needed to actually enter and leave rooms, as well as provide walls and dialogues. - If you don't know how to add something, look at other levels to see how they did it. You can just use Phase 1 to get more examples.
- To add custom images, make sure you also add the images into the game's SWF file
- Enough
CollRect.pngfiles to prevent the character to be able to move through walls - 1 (or more)
RoomTransitionObject[#].pngandentryObject[#].pngin your level, whose numbers/name correspond to what door they are placed near. Use numbers for internal doors between corridors and hallways, and the special names for their evident purpose
It's probably a better idea to not massively edit the utility files (except the CollRect.png files) within layer3, as modifying them has not been tested.
Now you have your edited level, it's time to add it back! (This assumes only 1 level was edited, for multiple levels read the extra bit)
- Move the
svg_to_xml.pyfile to therequired_imagesfolder. - Run
svg_to_xml.pywith the same method asxml_to_svg.py, then move the newdone.xmlfile to a new folder along withrecompresor.py. - Run
recompresor.py, and note the newrecryptedfolder. Within that folder you should have a.binfile. - Open JPEXS Free Flash Decompiler and open the game SWF file you want to modify.
- Once opened, click on the
+sign next to thebinaryDatasection on the left-hand menu. Scroll through these files until you find the room that you edited (the filename of the file from the very first step of Phase 1). You can instead search for it by pressingCtrl + Fand typing the file's name - Right click on this item and select the
Replaceoption. Now, navigate to the file in therecryptedfolder and select that.binfile. - Click the "Save All" button in the top menu, and then close JPEXS
You have successfully edited a level! It's recommended to test out if it works by playing that level.
Probably should mention this earlier, but I have tried to do this and have run into numerous errors. Consider adding levels at your own expense, and this will be updated when I can reliably add levels.
Q: There's no music in my level!
A: Music is automatically added from floor tiles. Try using [elementRoom]_groundTile.png instead of one of the variants.
Q: When I interact with someone it breaks the game! A: It hasn't been fully tested with overwriting dialogues, so for now it's best to not touch them.
Q: I want to add my own images/functionality! How do I do that? A: There is a way for both, but it's quite extensive. For now, just use the contact at the bottom. A guide will be added here later...
Q: I cannot enter my level!
A: You didn't add roomTransitionObject and entryObject triggers. See the IMPORTANT flag in phase 2.
Q: What's the XML_TO_SVG_Embed?
A: If you want to use the images for something else (to create a mockup etc), you can use that mode to get a standalone image that doesn't need the required_images folder! But, it can't be used to add it back into the game...
Q: [insert other unforseen circumstance]! A: Let me know! Let's solve it together!
If you want to deal with multiple rooms, or a whole level, some stuff works differently.
- First, set up a folder to contain all of this level editing stuff, otherwise stuff will get messy. Move anything you downloaded from here into this folder.
- Then, follow Phase 1 all the way up to point 3. For points 4 and 5, move only 1 ".xml" file into the
required_imagesfolder, then runxml_to_svg.pyas per point 5. Then renamedone.svgto a meaningful name (like its original name). Then repeat those steps until all are now in SVG.
Editing is the same, just read Phase 2
To add back into the game, follow this modified guide:
- Move
svg_to_xml.pyintorequired_images, and create a separate folder and moverecompresor.pyinto it. - Move 1 SVG file into
required_imagesand runsvg_to_xml.py. Rename and move thedone_xml.xmlto the same folder asrecompresor.pyis. - Repeat the above step until all SVG files are done.
- Run
recompresor.pyand all of the new XML files should be in therecryptedfolder. - Open JPEXS Free Flash Decompiler and open the game SWF file you want to modify.
- Once opened, click on the
+sign next to thebinaryDatasection on the left-hand menu. - For each converted XML file, find its original in the
binaryDatasection, right click on this item and select theReplaceoption. Now, navigate to the file in therecryptedfolder and select that.binfile. - Once all of the new files have replaced the old ones, click the "Save All" button in the top menu. Then close JPEXS
I've tried my best to make this guide as easy to use and approachable as possible. If I have missed the mark, then contact me (square_nine) with the links in my GitHub profile or by raising an issue here!