Godot Version
v4.4.1
Question
I’m fairly new to properly coding and am currently attempting to create a game. I decided to start working on the title scene but have been stuck trying to figure out why this if statement isn’t working, as it looks almost identical to several other examples and the brief documentation I’ve read so far hasn’t shown me it shouldn’t.
func _gui_input(event: InputEvent) -> void:
if event.is_action_pressed("guiClick"):
print("Click!")
if name == "new game":
# animation for game intro or something along those lines
print("New Game")
var scene : PackedScene = load("res://scenes/game.tscn")
get_tree().change_scene_to_packed(scene)
if name == "continue":
#scene 2 temp for testing purposes
print("Continue")
var scene2 : PackedScene = load("res://scenes/game_2.tscn")
get_tree().change_scene_to_packed(scene2)
I’m using labels as the buttons- they register as being pressed in debug and the intial “Click!” print does work, but I have no idea why the other statements aren’t working.