Skip to content

Character and Chart scripts

Super edited this page Sep 5, 2021 · 29 revisions

As of 0.5.0, you will be able to provide a script with characters or charts. You can use these scripts to add custom features and such to the game while only having it effect one song. To add a script, you just put a script.hscript in the character or song's folder

Character methods:

All methods contain a reference to the character as the first argument

  • startSong ()
  • endSong ()
  • initScript ()
  • new ()
  • update (elapsed)
  • playAnim (animName)

Song methods:

All methods contain a reference to playState as the first argument

  • startSong ()
  • generateSong ()
  • endSong ()
  • initScript ()
  • update (elapsed)
  • beatHit ()
  • stepHit ()

For unknown reasons, characters cannot be modified/accessed through playState.CHAR, You have to use:

  • charGet(charId:Int,field:String), charId is the character's ID, field is the field to access, charGet(0,"curCharacter") would return BF's character name
  • charGet(charId:Int, field:String, value:Dynamic), charId is the character's ID, field is the field to access, Value is the what to set it to.
  • charAnim(charId:Int,anim:String), charId is the character's ID, anim is the animation to play. For charId: 0=BF,1=Opponent,2=GF

BRtools

You can use BRtools to load sprites and play sounds without having to worry about the chart or character's folder path.
Available methods:

  • BRtools.loadSparrowSprite(x, y, PATH, ANIMATION, LOOP, FPS) - Loads a xml and png, example: spacebarthing = BRtools.loadSparrowSprite(0,0,"sprites/spacebar","spacepress",true);
  • BRtools.playSound(PATH, VOLUME) - Plays a sound, example: BRtools.playSound("sounds/Alarm.ogg",1);
  • BRtools.cacheSound(PATH),BRtools.cacheSprite(PATH) - loads a sound/sprite into memory. Example BRtools.cacheSprite("sprites/spacebar");

Clone this wiki locally