This repository was archived by the owner on Dec 30, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Dialogue Script
skellypupper edited this page May 29, 2023
·
17 revisions
Empty Script
Example dialogue scripts can be found here.
function create() {}
function update(elapsed:Float) {}
function preLine(portrait:String, ?textLine:String) {}
function finish() {
// code here
dia.finishCallback();
dia.kill();
}Make a dialogue script at dialogue/<boxname>/init.hxs, you can also place your box assets in the <boxname> folder.
You can use your dialogue box in a song script by calling game.openDialogueBox.
ex: game.openDialogueBox("<boxname>", [":bf:swag", ":dad:money"], game.startCountdown)
-
dia: The current dialogue class, used to edit the dialogue box. -
dia.portraits: AMapthat holds portraits for all dialogue characters. -
dia.speakTxt: TheFlxTypedTextinstance that reads out the dialogue. -
dia.groupTxt: AFlxTypedGroupcontaining thespeakTxt. Really only added to be used for the drop shadow text in week 6. -
dia.box: A nullFlxSpritethat is meant to be defined in thecreate()callback. If it's null after create is complete, the dialogue instance will close itself. If you really don't need a box sprite, you can set it to the bare minimum as shown below:
import flixel.FlxSprite;
function create() {
dia.box = new FlxSprite();
}-
Paths: A custom paths instance that only reads for files inside the<boxname>directory. -
_Paths: The global paths instance.
-
create(): Where you actually initialize everything.
-
createPost(): Called after the class is created. -
preLine(portrait:String, ?textLine:String): Called before the next line plays. -
update(elapsed:Float): Called every frame. -
finish(): Called when the dialogue complete or the player skips it early. If you use this callback you'll need to call the ending code:dia.finishCallback();dia.kill();.
You can set portraits like this: dia.portraits["namehere"] = new FlxSprite();
And set the sprite properties.
There are a few animations you can add to your portrait sprites to make them move during dialogue.
-
pre: Before the next dialogue line starts, this animation will play. -
enter: Whenever your portrait becomes visible, it will play once when the text starts. -
talk: While the dialogue is still being typed out, this animation will play.
Written for EE v1.1.0