Backgrounds

This contains the source code documentation of the class subsystem_Backgrounds.

subsystem_Backgrounds

Inherits: DialogicSubsystem

Subsystem for managing backgrounds.

Description

This subsystem has many different helper methods for managing backgrounds. For instance, you can listen to background changes via background_changed.

Properties

NameTypeDefault
default_background_scenePackedSceneload(...)
default_transitionStringpath_join(...)

Methods

ReturnsMethod
voidclear_game_state ( _clear_flag: int = 0 )
voidload_game_state ( _load_flag: int = 0 )
voidupdate_background ( scene: String = "", argument: String = "", fade_time: float = 0.0, transition_path: String = default_transition, force: bool = false )
SubViewportContaineradd_background_node ( scene: PackedScene, parent: DialogicNode_BackgroundHolder )
boolhas_background ( )

Signals

signal background_changed ( info: Dictionary )

Whenever a new background is set, this signal is emitted and contains a dictionary with the following keys:

KeyValue TypeValue
sceneStringThe scene path of the new background.
argumentStringInformation given to the background on its update routine.
fade_timefloatThe time the background may take to transition in.
same_sceneboolIf the new background uses the same Godot scene.

Property Descriptions

var default_background_scene = load(...)

The default background scene Dialogic will use.


var default_transition = path_join(...)

The default transition Dialogic will use.


Method Descriptions

func clear_game_state ( _clear_flag: int = 0 ) ⇒ void

Empties the current background state.


func load_game_state ( _load_flag: int = 0 ) ⇒ void

Loads the background state from the current state info.


func update_background ( scene: String = "", argument: String = "", fade_time: float = 0.0, transition_path: String = default_transition, force: bool = false ) ⇒ void

Method that adds a given scene as child of the DialogicNode_BackgroundHolder. It will call [_update_background()] on that scene with the given argument . It will call [_fade_in()] on that scene with the given fade time. Will call fade_out on previous backgrounds scene. If the scene is the same as the last background you can bypass another instantiating and use the same scene. To do so implement [_should_do_background_update()] on the custom background scene. Then [_update_background()] will be called directly on that previous scene.


func add_background_node ( scene: PackedScene, parent: DialogicNode_BackgroundHolder ) ⇒ SubViewportContainer

Adds sub-viewport with the given background scene as child to Dialogic scene.


func has_background ( ) ⇒ bool

Whether a background is set.