Skip to content

Game Systems

Guilherme Sousa edited this page May 2, 2023 · 3 revisions

Game Systems

These are all the pre-loaded nodes this project contains.

Scene Transition Manager

This node handles all transitions between scenes, with or without screen transitions.

Scene Transitions

A scene transition is a node that is instantiated when a scene is changed by the SceneTransitionManager. It hides fades in to hide the scene, triggers the actual scene change then fades out. Here's how you can create your own:

  1. Create a Transition node with an AnimationPlayer child, and specify the "Animation" property on the Transition node

image

  1. Add two animations to the animation player, these must be named FadeIn and FadeOut
  2. The FadeIn animation must start with a completely hidden screen on the first frame, and completely visible on the last frame.
  3. The FadeOut animation should have the opposite behavior: visible on first frame, hidden on the last. Make sure the first frame of FadeIn is identical to the last one of FadeOut! You will find some examples on res://scenes/scene_transitions/.

You now have your own transition! You can now using when changing scenes by calling:

SceneTransitionManager.change_scene_with_transition(new_scene, transition_scene)

Save Manager

⚠️ This system is still being improved! ⚠️ The SaveManager nodes handles saving and loading game state.

How to mark a node for save

All nodes that should be saved must be added to a "Saveable" group. Note that there is no need to define any serialization methods on the nodes, all exported properties will automatically be saved to the save file, with some exceptions (⚠️ this list is subject to change ⚠️):

  • Object type properties

Saving

Saving can be done by calling the following method

SaveManager.save_game()

This will save the name of the current scene and the state of all nodes in the "Saveable" group in that scene

Loading

Loading can be done by calling the following method

SaveManager.load_game()

This will first transition the the scene specified in the save file, and then load all the saved data for nodes in the "Saveable" group.

Changing Load Scene Transition

On loading the game, a scene change is triggered using a specific transition. Should you want to change that transition, you can do that by editing the save manager scene here: res://scenes/preloads/save_manager.tscn

Audio Manager

TODO