Godot Version
Gd4
Question
extends Control
@export var load_scene : PackedScene
@export var in_time : float = 0.5
@export var fade_in_time : float = 1.5
@export var pause_time : float = 1.5
@export var fade_out_time : float = 1.5
@export var out_time : float = 0.5
@export var splash_screen : TextureRect
func _ready() → void:
fade()
func fade() → void:
splash_screen.modulate.a = 0.0
var tween = self.create_tween()
tween.tween_interval(in_time)
tween.tween_property(splash_screen, “modulate:a”, 1.0, fade_in_time)
tween.tween_interval(pause_time)
tween.tween_property(splash_screen, “modulate:a”, 0.0, fade_out_time)
tween.tween_interval(out_time)
await tween.finished
func _unhandled_input(event: InputEvent) → void:
if event.is_pressed():
Global.game_controller.change_gui_scene(“res://Scenes/Main_Menu/menu.tscn”)
Called every frame. ‘delta’ is the elapsed time since the previous frame.
func _process(_delta):
pass
why does this error appear i just can’t figure it out:
Invaild call nonexistent function ‘change_gui_scene’ in base Nil
You’re Global does not have a game_controller
set. How is Global
defined?
Could you use get_tree().change_scene_to_file
instead?
my game_controller is global i even tested it
How did you test it? The error indicates Global.game_controller
is not set.
Could you share the Global script? Make sure to format it with three ticks.
Posting here so to be linked for later use instead of re-typing this every time
Make sure you paste scripts instead of screenshots. To properly format pasted code use three ticks ``` at the start and end of your paste like so:
```
# type or paste code here
func _ready() -> void:
print("My ready function!")
```
Results in:
# type or paste code here
func _ready() -> void:
print("My ready function!")
Press the </> button or ctrl+e in the forum to create these ticks.
[2024-09-02…
extends Node
‘’'var Player
var game_controller : GameController
and in game controller i put this:
func _ready() → void:
Global.game_controller = self
current_gui_scene = $menu’‘’
Do you have a game controller scene in this splash screen scene? Is GameController supposed to a Global/autoload too?
let me try rq i didn’t think of that
neither of those worked The GameController is referenced in the global script which is an autoload/Singleton im trying to transition from splash screen to the main menu i was doing so good but i’ve never had this problem sooo…
zachisjacked27:
neither of those worked
I didn’t recommend any action. What did you try?
Could you share a screenshot of your splash screen’s Scene tree? Maybe the in-game “remote” version