You can add a new microgame by duplicating the test microgame code files (tmg_test_game.h
and tmg_test_game.cpp
) and changing the namespace to a new one.
For example, if your new microgame is going to use the xyz
namespace, you can duplicate the mentioned code files with xyz_game.h
and xyz_game.cpp
as filenames.
Remember to change the namespace in the MJ_GAME_LIST_ADD
macro too.
Microgames must follow these rules in order to play along with other microgames, with the animations shown between them and with the pause menu:
- All code used by a microgame should be placed in its own namespace. For example, the test microgame uses the
tmg
namespace. - All code and asset files (graphics, music, etc.) used by a microgame should have the code namespace as filename prefix. For example, the test microgame uses
tmg_
as filename prefix. - All microgames must include a text file per asset type indicating the license of all used assets. For example, the test microgame uses
tmg_credits.txt
as credits filename. - The start key is used to show and hide the pause menu, so microgames should not use it.
- Butano core functions such as bn::core::update are handled outside of the microgames, so they should not call them.
- All sprites and backgrounds must have a priority greater than 0 (by default, sprites and backgrounds priority is 3).
- The system sprite color palette (used for rendering text, among other things) must not be changed.
- The pumpkin is rendered using a regular background, so microgames can't show two affine backgrounds or four regular backgrounds when the pumpkin is visible (it is visible when a microgame is created and when the
mj::game::fade_in
andmj::game::fade_out
methods are called). However, you can use all available backgrounds whenmj::game::play
is called. - Global palette functions like bn::bg_palettes::set_grayscale_intensity and bn::sprite_palettes::set_grayscale_intensity must be avoided, since they're used for the transition between microgames and the pause menu. You can apply palette effects to individual color palettes though.
- SRAM will be handled outside of the microgames, so they should not write it.
You can disable a microgame by commenting out the MJ_GAME_LIST_ADD
macro call.
For now it's in the header file (mj_game.h
).