Global
class Global extends Node
Methods
func _init() -> void
func fader_fade(start: float, end: float, time: float) -> void
Fades the opacity of the black transition screen from start opacity to end opacity in a given time. Note: You can use await to wait for the fader to finish before the code proceeds.
await Global.fader_fade(0.0, 1.0, 10)
Global.fader_fade(1.0, 0.0, 10)func fade_music(gain: float, time: float) -> void
Fades the global music to a given gain in a provided timeframe. Note: gain is in linear energy.
Global.fade_music(0.0, 20)func setup_discord_rpc() -> Variant
func play_ui_sound(sound_name: String, volume: float) -> void
Plays a ui sound from the 'res://sounds/ui/' directory of a given sound_name, which is provided as the file name without the file extension.
Global.play_ui_sound("menumove")func play_sound(sound_name: String, volume: float) -> void
func is_dark() -> bool
Returns whether the current global world type defined in Global.world_type is the dark world or not. If Global.world_type is not equal to Global.WorldTypes.WORLD_DARK (for example, it might be equal to Global.WorldTypes.WORLD_LIGHT), this method will then return false. If Global.world_type IS equal to Global.WorldTypes.WORLD_DARK, it will then finally return true, confirming that, indeed, Global.world_type is currently the dark world.
Global.is_dark()func sec_to_frames(seconds: float) -> float
Converts seconds to physics frames (1/30th of a second)
Global.sec_to_frames(2.5) #returns 75.0func frames_to_sec(frames: float) -> float
Converts physics frames (1/30th of a second) to seconds
Global.frames_to_sec(75.0) #returns 2.5