This is an excerpt of code I have for a game I've been working on:
var scene_number = 0
func _on_Area2D_input_event(viewport, event, shape_idx):
if event is InputEventMouseButton:
scene_number += 1
print(scene_number)
func stop_music():
if scene_number == 1:
print("hello")
The scene number updates when I click on a sprite and I've confirmed this with a print function, so how come it won't print out "hello" when the scene_number == 1 (after one mouse click)