All Questions

Community

b
yousef bohadi
posted to: Firing the Hook

Invalid get index 'cooldown'

After compiling the code up to this point, when I run the game I get the following error: Invalid get index 'cooldown' (on base: 'position2D(Hook.gd)'). the error also points to the enter() function in the Fire.gd

func enter(msg: Dictionary = {}) -> void: owner.cooldown.connect("timeout", self, "_on_Cooldown_timeout") owner.cooldown.start()
  • Correct

    You're trying to access a variable called `cooldown` on the `owner`, in this case, the `Hook` node. Check Hook.gd: `cooldown` is either not defined, or more likely, there is a typo. You should have a line that looks like that in Hook.gd:

    onready var cooldown: Timer = $Cooldown