Godot Version
Godot 4.5.1
Question
Hello I am quite new to Godot and try to make a 2D platformer.
I made a 2 Levels, a main screen and a level selec all of with are Scences.
Before I had them change by just going get_tree(), but that got a bit Spaghetti like, so I tried to centralize the Scene Changing in an over-all node and connect everything with custom signals.
But the Signals don’t connect for some reason.
“Main on” is printed, but “Game on“ not
Game Node Code:
extends Node
const main = preload("uid://cqghuyaoy4b0t")
const LvL_Auswahl = preload("uid://b3lxwuhfubh7h")
const LvL1 = preload("uid://2pyu8wtsfi2e")
const LvL2 = preload("uid://wcavvr355lnu")
signal zu_main
signal von_main_zu_lvl_auswahl
func _on_lvl_auswahl_zu_lvl_1() -> void:
get_tree().change_scene_to_packed(LvL1)
func _on_lvl_auswahl_zu_lvl_2() -> void:
get_tree().change_scene_to_packed(LvL2)
func _on_lvl_auswahl_zu_main() -> void:
get_tree().change_scene_to_packed(main)
func _on_lv_l_1_zu_lvl_2() -> void:
get_tree().change_scene_to_packed(LvL2)
func _on_main_zu_lvl_auswahl() -> void:
get_tree().change_scene_to_packed(LvL_Auswahl)
print("Game on")
Main Screen Code:
extends Control
#const LvL1 = preload("res://LvL_auswahl/LvL_auswahl.tscn")
signal zu_lvl_auswahl
#das ist der Play Button
func _on_button_play_pressed() -> void:
#get_tree().change_scene_to_packed(LvL1)
zu_lvl_auswahl.emit()
print("main on")
#das ist der New Game Button
func _on_button_new_game_pressed() -> void:
pass # Replace with function body.
#Das ist der Options Button
func _on_button_options_pressed() -> void:
pass # Replace with function body.
#Das ist der Quit Button
func _on_button_quit_pressed() -> void:
get_tree().quit()
