Skip to content
This repository was archived by the owner on Dec 30, 2023. It is now read-only.

Stage Script

skellypupper edited this page May 28, 2023 · 15 revisions

Empty Stage Script - Example Stage Script

Stage scripts are used to create stages.

How to use

Make a stage script at stages/<stagenamehere>/init.hxs. You can put your assets in the same folder.

Unlike other script types, Paths searches for local paths like the assets folder instead of at the top layer. This means Paths.image("bg") will look for stages/<stagenamehere>/images/bg.png. If you'd prefer the standard method of searching, make the first line in your create callback Paths.useFullDir = false;.

Make your sprites and add them via the add function.

Variables

  • stage: The current stage class (an extended FlxTypedGroup). Used to edit your stage.
  • stage.publicSprites: A Map for public sprite variables. Add sprites here if you want to mess with them outside of the stage script.
  • stage.foreground: A FlxTypedGroup that gets added after the rest of the sprites.
  • stage.infrontOfGf: A FlxTypedGroup that gets added in front of girlfriend. (i hate limo so much)
  • Paths: A custom paths instance that only reads for files inside the <stagenamehere> directory.
  • _Paths: The global paths instance.

PlayState variables

  • PlayState.defaultCamZoom: A float value for how zoomed in the camera is on your stage. (default: 1.05)
  • PlayState.curUi: A string value for which ui type (strums, notes and combo) should be used. (Game comes with support for "normal" and "pixel")
  • PlayState.startOn: A dynamic value that allows you to set where the camera begins at on your stage, this can be set to bf, gf, dad or a 2 float value array.
  • PlayState.moveCam(val:Dynamic): Same as above, but it's a function you can call mid-game.

Callbacks

Required

  • create(): This is where you actually create all your stage variables.

Optional

  • createPost(): A function called after the stage, bf (PlayState.bf), gf (PlayState.gf) and dad (PlayState.dad) are created, recommended use of this callback would be repositioning characters.
  • stepHit(step:Int): Called every time a step is hit from the PlayState. Good for making background characters bop.
  • beatHit(beat:Int): Called every time a beat is hit from the PlayState.
  • sectionHit(section:Int): Called every time a section is hit from the PlayState.
  • update(elapsed:Float): Called every frame.
Clone this wiki locally