Skip to content

Making a New State or Stage

Yozzaxia1311 edited this page Aug 29, 2021 · 1 revision

After learning Mega Man Love's controls, naturally, you'll want to start shoving game stuff into your game.

The State System

About States

There are two types of states:

  • State: the file name is formatted with a .state. in-between the name and file extension (Ex. (statename).state.lua). Resources and objects are always cleaned after state-switching.
  • Stage: the file name is formatted with a .stage. in-between the name and file extension. Resources and objects are cleaned up if the player has game-overed.

And there are (currently) two supported formats:

  • .tmx: Tiled Map Editor tile map files. May use a state object returned by (mapname).lua, if in the same directory. In-editor map properties (Map -> Map Properties... -> Custom Properties) are taken into account:
    • fadeIn: boolean (true by default) -> fade in from previous state.
    • musicPath: string -> music to play. (Check out TODO for more info.)
    • musicVolume: float (1.0 by default) -> music volume from 1 to 0.
    • state: string -> overrides default state choice.
  • .lua: must return a state object. (Check out TODO for more info.)