- Edited
I copied and pasted this line of code that the error was appearing on and no sign of the word 'disabled'. There is however lower down in the code a timer signal connected function that uses it. I cannot work out what is wrong because I cannot find anywere through breakpoints that the link button I was controlling with the 'disabled' property doesn't have an instance attatched. I even looked in the remote scene debugger and no sign of it going wrong.
extends CanvasLayer
signal restart
enum State {SETUP, PLAYING, MENU}
onready var credits_btn = $Menu/CreditsButton
func _ready():
set_process(false)
show_mode(State.SETUP)
func _process(delta):
# Use the flying buttons to restart the game if the menu is active and the accidental-click period has ended
if Input.is_action_just_released("fly") and $Menu.visible and not $Menu/CenterContainer/MenuBackground/CenterContainer/VBoxContainer/CenterContainer/TextureButton.disabled:
_on_TextureButton_pressed()
func set_score_label(score):
# Set both of the score labels in step
$ScoreLabel.text = str(score)
$Menu/CenterContainer/MenuBackground/CenterContainer/VBoxContainer/CurrentScore/ScoreLabel.text = str(score)
func set_previous_best(score):
$Menu/CenterContainer/MenuBackground/CenterContainer/VBoxContainer/PreviousBest/ScoreLabel.text = str(score)
func show_mode(mode):
match mode:
State.SETUP:
$ScoreLabel.hide()
$Menu.hide()
State.PLAYING:
$ScoreLabel.show()
$Menu.hide()
State.MENU:
$ScoreLabel.hide()
$Menu.modulate.a = 0
$Menu.show()
credits_btn.disabled = true
$AllowClIck.start()
$AnimationPlayer.play("fade_in_menu")
func _on_TextureButton_pressed():
emit_signal("restart")
func _on_Dialog_dialog_ended():
show_mode(State.PLAYING)
func _on_Player_death():
show_mode(State.MENU)
func _on_CreditsButton_pressed():
var credits_window_scene = load("res://Scenes/HUD/Credits.tscn")
var id = credits_window_scene.instance()
add_child(id)
id.connect("closed", self, "_on_CreditsWindow_closed")
set_process(false)
func _on_CreditsWindow_closed():
set_process(true)
func _on_AllowClIck_timeout():
set_process(true)
credits_btn.disabled = false