Here I'll be posting modular resources for use in your cartridges! Each cartridge includes both shortened code, taking up a minimum of tokens, as well as expanded code, with lots of nice formatting and explanatory comments. They're all released under the zlib/libpng license so please feel free to use them in your own project!
Like me, you may think the default font is kind of awful. If you do, here's some code that will help you render your own! The example font has 64 characters and starts at 0 in sprite memory, but you have full control over which characters are included and where they're located at and in which order they appear by making easy modifications to just a few variables. Take a look at the code to see how it's done!
You might find yourself needing more input functionality than just btn and btnp. In this cartridge you can find functions to tell you when a button has been pressed (without repeating like btnp), when a button has been released, and how long a button has been pressed or how long it's been released.
Pathfinding can be tricky, so this cartridge includes an implementation of the A* algorithm. This particular implementation is confined to pathfinding on 2D grids, but otherwise it's very flexible. You'll be able to assign your own movement cost and heuristic functions, and a good deal more. The implementation also comes with sensible defaults, so if you're not sure about the details you can mostly leave them up to the code as it is.
Minesweeper! Features multiple difficulty levels and amazing sound effects. Released under the zlib/libpng license.
Arrows transport cursor and navigate menu
Z reveal tiles or activate menu options, menu opened when tiles not revealed
X flag tiles for knowledge