Make Choices
You can crerate a menu with choices by using the Menu element.
const narrator = new Character(null);
/**
* What should I do?
* - Go left
* ~> *You went left.*
* ~> jump to scene "scene_went_left"
*
* - Go right
* ~> *You went right.*
* ~> jump to scene "scene_went_right"
*/
scene.action([
new Menu("What should I do?")
.choose("Go left", [
narrator.say("You went left."),
/* ... */
scene.jump(scene_went_left),
])
.choose("Go right", [
narrator.say("You went right."),
/* ... */
scene.jump(scene_went_right),
]);
]);
You can show the menu prompt with a custom Sentence.
// Show the menu prompt with a custom sentence
new Menu(
new Sentence("What should I do?", {italic: true}) // "What should I do?" with italic style
).choose(
new Sentence([
"Go ", Word.bold("left")) // "Go left" with "left" in bold style
]
), [
/* ... */
])