`Hi, so I am doing something very basic… Something that doesn’t really have to be done…
I have already paid for a Google Play Company so I figured instead of just (Config Splash Screen) I would make a piece of code that runs the Company branding for 5 seconds → then change_scene_to_packed() → then run the Game Logo for 5 Seconds and then after change_to_packed() run the title screen…
In the past I have used the inspector nodes for coding but this time I used AI to get started (Which means instead of clicking the nodes I was using Code…
I am now using a Timer Node, the Timer is linked to this script:
extends Timer
@onready var timer: Timer = $Timer #PRELOADS
var company_splash = preload(“res://Scenes/LoadingScreens/CompanySplash.tscn”)
var branding_splash = preload(“res://Scenes/LoadingScreens/BrandingScreen.tscn”)
var title_screen = preload(“res://Scenes/TitleScreen.tscn”)
Thank you two for your help, especially your help @hyvernox
I did not get any errors in this and it partially works…
I had to wait awhile but it eventually shows the Company Logo before crashing… I think I might know why…
First I’ll show the code:
match step:
1:
get_tree().change_scene_to_packed(company_splash)
start(5.0) #This is where the error is
step = 2
2:
get_tree().change_scene_to_packed(branding_splash)
start(5.0)
step = 3
3:
get_tree().change_scene_to_packed(title_screen)
Now, the Timer Node has a wait time which I set to 5 seconds, but in the code:
start(5.0)
I think the error is start is being assigned to 5.0 seconds each time… and in the inspector it is waiting 5 seconds (1 time?)
Would this be possible/fix it?
match step:
1:
get_tree().change_scene_to_packed(company_splash)
start() #Runs for 5 seconds naturally?
step = 2
2:
get_tree().change_scene_to_packed(branding_splash)
start() #Runs for 5 seconds naturally?
step = 3
3:
get_tree().change_scene_to_packed(title_screen)
start(5.0) just sets wait_time to 5.0 and starts the timer, so I don’t think this would help.
I assume it’s the use of get_tree().change_scene_to_packed(): This function replaces the current scene by the packed scene, which should delete the timer (or at least remove it from the scene tree). I think it would work if the timer’s scene would be used as a singelton though?