snozbot / fungus

An easy to use Unity 3D library for creating illustrated Interactive Fiction games and more.
MIT License
1.59k stars 291 forks source link

How To Add Fungus Branching Paths to fighting game #1068

Open MaximumMarc opened 1 month ago

MaximumMarc commented 1 month ago

I was wondering how to include a level select menu in Fungus, where the first level button activates a Fungus story that will determine what 10 level buttons will become visible next depending on what option the player chooses. Each of the 10 levels involve fighting and defeating enemies. After those levels have been completed a new button appears underneath the title button representing the level menu the player just completed, the new title button will contain levels corresponding to the player’s choice in the first level menu. And the first level button in this menu would also contain choices the player could make which decide which 10 level buttons appear next and what level menu will be available after completing them. This pattern will continue until the player reaches the end of the story. How can this game be made using fungus, and how do I make sure the player can’t go back and choose a different option if they’ve already chosen once?

Fyi the forum isn’t loading which is why I posted this question here.

Arylos07 commented 2 weeks ago

It sounds to me like there's other questions of design to answer here but I'm going to do a general overview. I'm going to make assumptions though so feel free to cater my thinking to your needs.

First off, you're going to need a saving solution. Fungus does have a built-in variable saving system although any good programmer would advise you to make your own; you can always import/export variables from your save system. I would then have your flowchart create different UI buttons or branches based on player progress, like a counter from 1 to 10 that increments with each fight they win. With each increment, a new button appears. You would then save this counter somewhere.

Depending on how you structure your game, you can then have Fungus load different scenes for your fights or call functions on different flowcharts in the same scene for simplicity. Or the same flowchart that has an if branch checking on this internal counter and determines what actually happens; ranging from difficulty to dialogue.

To restrict backtracking, you can still use the same counter to validate. In theory, I assume that only the next fight is made available while the past fights will appear as disabled UI elements. So realistically, activate the button for the current fight and make all others uninteractable (see the Clickable property on GUI elements like buttons; I use this all the time).