NesFishy game template: side-scrolling platformer
=================================================

Game > Build and Run in Mesen (F6) in NesFishy puts your project into this folder
("<project>_game", next to the project), builds the ROM with cc65 (ca65 + ld65)
and opens it in Mesen. Set the cc65 tools folder and Mesen in Workspaces > Settings.

Files
  main.s          the engine (yours: NesFishy copies it once and never overwrites it;
                  delete it to get a fresh copy on the next build)
  nes.cfg         memory layout (NROM-256: 32 KB code + data, 8 KB tiles)
  modules/        add-ons, one folder each (see MODULES.txt)
  game_data.s     made on every build: palettes, the map (top row of the Map), tile
  game_data.inc   properties, sprites, Game Object tables, where objects start
  modules.s       made on every build from the modules folder
  chr.bin         made on every build: the background bank + the sprite bank
  <project>.nes   the ROM; game.lbl / game.dbg are labels for Mesen's debugger

What it does
  - Levels: each row of the Map is a level, played left to right; walking off the
    right end goes to the next row (after the last, back to the first). Identical
    screens are stored once.
  - Scrolls left / right (vertical mirroring, a new column of tiles streamed in as
    the camera moves).
  - Tile properties (Properties panel): 1st = solid, 2nd = platform (stand on it
    from above), 3rd = ladder (Up / Down climbs, Left / Right moves slowly, A lets
    go; give the top tile of a ladder platform + ladder to stand on it), 4th =
    hazard (hurts).
  - Objects from the Game Object builder: the player (type Player, the one on an
    Object layer in each level, or the first one) and every object placed on
    Object layers, spawned as the camera reaches them. Each state uses its move
    type and physics (speed, accel, friction, gravity, jump, max fall), animation
    per direction, and its rules (buttons, timer, animation end, landed / in the
    air, wall, ledge, touching the player / an enemy, hurt, health 0, random,
    player near).
  - Contacts: pickups add their points to score, count as coins and vanish;
    enemies that hurt the player take its health (then it blinks for a second);
    landing on top of an enemy that can be hurt stomps it.
  - HUD: the first HUD placed at the top (HUD / UI Boxes, Where: Top strip) stays
    still while the level scrolls (sprite 0 split on its lowest solid pixel; it
    uses sprite tile $FF). Numbers and meters update by their names:
      Score / Points -> score, Health / HP / Hearts -> the player's health,
      Coins / Gems / Rings -> coins, Lives -> lives, Time / Timer -> a countdown
      from 300 (at 0 the player loses), any other name -> hud_var + n (n = its
      place among the HUD's numbers and meters; set it from a module).
    Keep the level's top rows (under the HUD) empty: they're hidden.
  - Lives: 3; losing them all starts again from the first level.
  - Sounds: jump, hurt, stomp, pickup, death and level end call the modules'
    sound hook (modules/sfx plays simple beeps; replace it with your own).
  - Up to 12 objects at once; sprites take turns when there are too many on a line.


Updating: when NesFishy gets a newer template, the files you haven't changed
(main.s, README.txt, MODULES.txt) are updated on the next build (the old one is
kept as .old); new modules are added; files you changed are left alone.

Game Types and Game Options
  This folder is a copy of templates\platformer\ (next to NesFishy.exe). Every folder
  there with a main.s shows up in Game > Game Type; copy one to make your own.
  template.ini names it and lists its Game Options (Game > Game Options): each
  one is written to game_data.inc as a constant (e.g. START_LIVES = 3) on every
  build, so main.s and modules can use it. Add options to template.ini for your
  own constants.

Palettes per screen, flip-screen and fades
  Each Map screen can use its own palette set (right-click it on the Map, or pick
  one for the whole screen in the Screens list). Only one set can be on the TV at
  a time, so when the middle of the camera reaches a screen with another set the
  game fades out, swaps the set and fades back in (Game Options: fade speed, 0 =
  swap at once). With Flip-screen on, the camera shows one whole screen at a time
  and cuts to the next when the player crosses into it (a different set fades in
  from black).

Smooth up and down scrolling (Game Options > Up and down Map rows = Smooth)
  The Map rows make one tall world (up to 8 rows) and the camera follows the
  player up and down as well as sideways; new rows of tiles stream in like the
  columns. Jump and fall between the rows; falling off the bottom row loses a
  life, and the end of the last screen of a row ends the game (the Ending screen,
  else it starts over). Objects live anywhere in it (y in world pixels). The HUD (Game Options > HUD with smooth
  scrolling): left out, Sprites (the top HUD's numbers and meters drawn as sprites,
  each in its element's palette, used as a sprite palette; at most 8 on a row;
  boxes and text are left out) or Status bar (MMC3: the whole top HUD stays still
  at the top, kept in a third nametable with 4-screen VRAM; an IRQ shows the level
  under it and again where the level's rows wrap; no splits then; the top of the
  world is under the bar). With the MMC3 cartridge every screen goes in
  one bank: up to 15 different screens (repeated screens are stored once).

Title, Game Over and Ending screens
  Right-click an entry in the Screens list > In the Game: Level (its Map is the
  game's levels), Title screen (shown at power on until Start), Game Over screen
  (when the lives run out, then back to the title) or Ending screen (after the
  last level). Each shows its screen with its palette set, using the levels' tiles.

Players, saving, PAL (Game Options)
  2 players: controller 2 moves a second Player (the second Player game object,
  or a copy of the first); the players share the lives. Battery save: keeps the
  high score and how far you got (Start continues, Select + Start starts over); a
  HUD number named "High" shows the high score. Same speed on PAL: 50 Hz consoles
  take an extra step every 5 frames. Game Object states can be drawn behind the
  background ("Behind the background" in the Game Object builder).

Music (FamiStudio)
  Game > Music Files: pick the songs (and sound effects) exported from FamiStudio
  (File > Export > FamiStudio Sound Engine Assembly, CA65). Each build copies them
  into music/ here; music/famistudio_ca65.s is the FamiStudio sound engine. A .dmc
  file next to the music file brings its DPCM samples (placed at the end of the
  ROM). The Sounds panel says which song plays where: each Map screen's music (it
  starts when the camera reaches that screen), the Title / Game Over / Ending
  screens' music (or a game state named Title / Game Over / Ending). Sound
  effects named Jump, Hurt, Stomp, Pickup, Die, Level / Door, Shoot play through
  FamiStudio; the others still use the sfx module. The pause module pauses the
  song too.

Cartridge: NROM or MMC3 (Game Options > Cartridge)
  NROM: 32 KB, one 8 KB set of tiles. MMC3 (256 KB, mapper 4): each level gets
  its own 16 KB bank for its screens (up to 15 screens a level, 14 levels; top-
  down: 15 screens a bank), every CHR bank of the project goes in, the Title /
  Game Over / Ending screens show with their own CHR bank, and the CHR Animation
  bank swaps (128- or 256-tile regions) play in the game. The code and the other
  data stay in the fixed 16 KB at $C000 (with the music and DPCM samples).
  NesFishy links with nes_mmc3.cfg then.

Splits: parallax, wavy water, a bottom status bar (MMC3)
  The Scroll / Mirroring Preview's splits (View > Scroll / Mirroring Preview) are
  saved in the project and the game uses them with the MMC3 cartridge: each band
  below a split line is Fixed (its own X), Main (with the camera), Parallax (the
  camera's X at its speed, plus an offset) or Wavy (with the camera, its lines
  rippling left and right). The band under the top HUD moves at the "Top band"
  speed. Up to 6 splits; only X changes mid-screen. For parallax the band's rows
  should look the same all along the level (sky, far hills): the band shows the
  level's own tiles, scrolled at another speed. A HUD placed at the Bottom (HUD /
  UI Boxes) becomes a status bar kept still at the bottom (2, 6 or 8 rows). Use
  8x8 sprites with splits (the MMC3 counts lines with the sprite fetches).
