Log In  

Cart #43893 | 2017-09-03 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA

Hey there, I did a few weeks ago a mini cart showing how Earthbound or Mother 3 would do most of the background effects.

I redid the whole routine and made two versions, vertical and horiztontal, which should cover a big part of the basics behind those games' technique (the rest being layer blending, scaling, palette cycling, or alternating backgrounds per line).

There are two implementations, sspr-based and map-based. The sspr based uses the data of a sprite at given coords and size to tile it on the screen whereas the map-based routines uses the map routine to directly draw a line of pixels on the screen. The map-based routines uses part of the map data but it makes up for allowing more than one sprite to be used, as you can see with the sample's colored corner areas.

Notes about the implementation:

  • I used time, amplitude, frequency and scale as global variables to make the implementation a bit less repetitive but you can pass them as arguments to the functions to have different settings
  • The map-based routines (map_<routine name>) assume that you're using at least a 16*16 map, but can be bigger. I haven't programmed an iteration allowing to use smaller maps to make it faster (as it'd use more than two map calls per line)
  • The map routines overrides camera and clip settings. Make sure to save their context before using.
P#43894 2017-09-03 10:54 ( Edited 2017-09-03 14:54)

[Please log in to post a comment]