Lineguide.lua

From Moondust Wiki
Revision as of 00:08, 21 March 2017 by Sambo (talk | contribs) (→‎Installation: Fixed link)
Jump to navigation Jump to search

This library adds all the Line Guides from SMW to SMBX, with full support for layer movement/showing/hiding. It also allows the user to attach any NPC to a Line Guide like in Super Mario Maker.

Requires the Colliders library.

Installation

  1. Download the API here
  2. Drop lineguide.lua into your LuaScriptsLib folder.
  3. Move the "lineguide gfx" folder to any location of your choice. It contains:
    1. All the needed custom graphics, set to overwrite the BGOs with the default IDs used in this API.
    2. txt files to change the grid size for the line BGOs to 16x16 in PGE
    3. A tileset file for PGE.

Use

To use this API in a level:

  1. Copy the files from the "lineguide gfx" folder into your level's folder. Be sure to change the names of the images so there are no conflicts. (If you are using GIFs for CGFX in your level, make sure the new graphics don't have the same name as any existing. Your OS won't report this if this is the case.) Make note of any ID changes made to the line BGOs.
  2. Place this at the top of the level's lunadll.lua file:
    local lineguide = API.load("lineguide")
    
  3. Set the line ID variables to match the IDs of any line BGOs you needed to rename to prevent a conflict.
  4. Start using better Line Guides in SMBX!


Variables

These are variables the user can access and set. They are all part of the lineguide namespace, so you must put "lineguide." before each.

General

Name Type Description
debug bool Set to true for debug mode, which will display the various collider objects used in this API.
properties table of properties Contains the properties of the NPCs that have been configured to connect to lines. See the section labelled "Properties" for more information.
lineNpcs table of IDs Contains the IDs of all NPCs that will attach to Line Guides. NPCs that are platforms in vanilla SMBX need not be added by the user.

Line BGO IDs

These variables contain the IDs of the BGOs that are being used as Line Guides. Since these values are loaded in initialization, setting them anywhere other than in the top of your Luna.lua file will have no effect. DO NOT use vanilla SMBX Line Guides anywhere in a level where this API is used, as they will interfere with this API's functionality, not to mention that they will behave very strangely. Any BGO can be used, provided it has the right dimensions (You can use bgofix.lua to change the dimensions of any BGO!) and it is not a vanilla Line Guide.

Name Line Type Default Value
directionSwitch Lineguide buffer.png 66
lineHorizontal Lineguide horizontal.png 44
lineVertical Lineguide vertical.png 21
lineSlopeMid1 Lineguide slopeMid1.png 37
lineSlopeMid2 Lineguide slopeMid2.png 43
lineSlopeGentle1 Lineguide slopeGent1.png 33
lineSlopeGentle2 Lineguide slopeGent2.png 163
lineSlopeSteep1 Lineguide slopeSteep1.png 54
lineSlopeSteep2 Lineguide slopeSteep2.png 59
circleSmall1 Lineguide circleSmall1.png 57
circleSmall2 Lineguide circleSmall2.png 58
circleSmall3 Lineguide circleSmall3.png 62
circleSmall4 Lineguide circleSmall4.png 63
circleBig1 Lineguide circleBig1.png 14
circleBig2 Lineguide circleBig2.png 29
circleBig3 Lineguide circleBig3.png 39
circleBig4 Lineguide circleBig4.png 41

Properties

These variables contain the properties of the NPCs which control their behavior relating to this API. They are accessed using the format "properties[ID].PROPERTY." For example, to access the "lineSpeed" property of the SMB3 Goomba, you would use:

lineguide.properties[1].lineSpeed
Name Type Default Description
lineSpeed double 2 The speed, in pixels per second, at which the NPC travels on a line.
jumpSpeed double 4 The speed, in pixels per second, at which the NPC moves when it "jumps" off the end of a line. This only applies if there is any upward movement when the end of the line is reached.

Notes/Issues

  • When placing Line Guides in a level, the grid should be 16x16. The background-* txts provided in the graphics download will give these BGOs a 16x16 grid in the PGE editor.
  • Vanilla Line Guides will not work with this API. They interfere with platform movement, and they behave strangely when this API is loaded. It is best to avoid using them altogether in a level that uses this API.
  • NPCs created by NPC spawners will not connect to Line Guides. Since spawners are commonly used to create new platforms on lines, a future update will include a workaround for this issue.