I'm trying to make a pretty linear game that has Chapter 1, Chapter 2, etc, obviously with each one having a different content but sharing similarities (e.g. that each chapter has a chapter title). I want these chapters to happen one after another (for now, they should just show the chapter title and then start the next chapter).
What's the best way to go about this?
So far I have:
created a Chapter scene (
chapter.tscn) (class nameChapter) with exported variables such aschapter_name(of typeString) andnext_chapter(of typeChapter).added several of those Chapter scenes to my main game scene (Chapter1, Chapter2, …), giving them names and assigning the next chapters.
added an exported variable
first_chapterin my main game node so I can refer to the first chapter in the code.
In the script of my main game scene (which is my main menu), I want to switch to the scene of the first_chapter (which is of type Chapter) when the “New Game” button is pressed. (Then that scene would do some stuff like show the chapter title and switch to the next chapter.)
Unfortunately, I don’t know how to switch to that first_chapter scene.
I know how to switch to a scene file (get_tree().change_scene_to_file(“res://chapter.tscn”)) but that is not what I want to do here; I don’t want to switch to the Chapter scene in general, but specifically the instance Chapter1 in my tree (in my first_chapter variable)