HalfstarDev / matchanovel

A visual novel framework library for Defold.
MIT License
36 stars 2 forks source link

Is it possible to make a conditional answer buttons? #1

Open ProgrammingLife opened 8 months ago

ProgrammingLife commented 8 months ago

Let's say I wanna create a novel with 10 endings. Is it possible to make a conditional answer buttons that will lead a story to another novel ending?

HalfstarDev commented 8 months ago

You can use Choices and If-Else to create conditional choices.

A simple choice would work like this:

> Open left door.
  jump left
> Open right door.
  jump right

And you would continue at label left or label right depending on the choice of the player.

You could put the choice in an If-Else-block, for example to add a third choice if you have a key:

if has_key
  > Open left door.
    jump left
  > Open right door.
    jump right
  > Open locked door.
    jump locked_door
else
  > Open left door.
    jump left
  > Open right door.
    jump right

I'd like to add more options to customize choices in the future, like having an if-condition for each individual answer. If you have a scenario that would not work with the method above, you can share it here.