I'm very new to this, and recently completed a tutorial. I decided to make a similar project so that I could put into practice what I learned, and now I'm totally stuck on what should be a very minor feature. I have no idea where else to look. Google and ChatGPT have been unfruitful in identifying why this issue is happening.
I have a character, that when he dies emits a signal that my game file picks up, and runs a function stored in my singleton to return to the main menu. The singleton can facilitate me going from the Main_menu to the game, but it doesn't work when going back. Here are the three relevant scripts:
func die() -> void: _dead = true blob_movement.stop() animation_player.play("die") print("Before Emit") on_blob_died.emit() print("After Emit") set_physics_process(false)
The Character script is instantiated into my game script which has:
func _on_blob_died(): print("Signal Recieved!") GameManager.load_main_scene()
My GameManager Singleton Script:
var game_scene: PackedScene = preload("res://game/game.tscn") var main_scene: PackedScene = preload("res://Main_Menu/main_menu.tscn") func load_game_scene() -> void: get_tree().change_scene_to_packed(game_scene) func load_main_scene() -> void: get_tree().change_scene_to_packed(main_scene)
I am PULLING my non-existent hair out on this. As everything looks right. The signal is emitting, but it's not being picked up in my game script.
Does anyone see anything obvious that I'm doing wrong?