-
Notifications
You must be signed in to change notification settings - Fork 6
Character and Chart scripts
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
All methods contain a reference to the character as the first argument
-
startSong ()
-
endSong ()
-
initScript ()
-
new ()
-
update (elapsed)
-
playAnim (animName)
-
noteHit (char,note)Called when a note is hit by the character
All methods contain a reference to playState as the first argument
-
startSong ()
-
generateSong ()
-
endSong ()
-
initScript ()
-
update (elapsed)
-
beatHit ()
-
stepHit ()
-
noteHit/noteHitDad (char,note)- Called when a note is hit
-
noteCreate (note,rawNote)- Called on note creation, can be used to make custom notes with note.type. rawNote is the rawJson note the game processes
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
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. ExampleBRtools.cacheSprite("sprites/spacebar"); -
BRtools.loadSparrowFrames(PATH)- Loads and returns a FlxAtlasFrames object, can be used to replace the frames of an object if desired
Example:OBJECT.frames = BRtools.loadSparrowFrames("sprites/object")