The issue I'm having is when I go to the "game over" scene and then try and go back to the main game scene, i doesn't work.
The game loads fine, and it switches to the game over scene fine, but when I press the "again?" button, it doesn't do anything. I put a print statement and that works, but the scene doesn't change.
I'm using get_tree().change_scene("path/to/my/scene") for both going to the game over scene and for trying to go back to the main scene. The scene change example godot came with works, as well as any other example that came with it usung get_tree().change_scene()
Main.gd
extends Area2D
var survivors_label
func _ready():
set_fixed_process(true)
survivors_label = get_node("Survivors_Label")
survivors_label.set_text("Survivors: %s" % globals.survivor_count)
func _fixed_process(delta):
survivors_label.set_text("Survivors: %s" % globals.survivor_count)
if (globals.survivor_count <= 0):
get_tree().change_scene("res://ZombiePop/Scenes/GameOver.tscn")
GameOver.gd
extends Node
func _ready():
pass
func _on_Button_pressed():
get_tree().change_scene("res://ZombiePop/Scenes/Main.tscn")
print("done")