Hello,

I've been following the basic set of tutorials on the website here just getting started with Godot and I've run into what I believe is a very basic problem.
I have reached the point in which I am attempting to connect signals through code, and I'm unable to get past one line.

Below is the script that I've written following the tutorial and making very slight personal modifications.

The first error I received was "on_timer_timeout isn't declared in the current scope." on the line: timer.timeout.connect(on_Timer_timeout)
I changed that to timer.timeout.connect(_on_Timer_timeout()) to alleviate that error, and ran into "Invalid get index 'timeout' (on base: 'Timer')"

Any pointers in the right direction would be greatly appreciated. I'm currently running Godot 3.5.1. If 4.0 was possible at the moment I would go with it, but my project PC is an
old build with an i7-3770k @ 3.5 GHz cpu and GeForce GTX 680 graphics card on Windows 7. Because of this I can only open projects using the openGL work around, and cannot run any projects in 4.0 without it crashing immediately.

Tree looks as follows:

extends Sprite

var speed = 200
var angular_speed = 2 * PI
var motionIsOn = 0

func _ready():
	var timer = get_node("Timer")
	timer.timeout.connect(_on_Timer_timeout)

func _process(delta):
	var velocity = Vector2.UP.rotated(rotation) * speed * delta
	if(motionIsOn == 1):	
		if Input.is_action_pressed("ui_left"):
			rotation += angular_speed * -1 * delta
		if Input.is_action_pressed("ui_right"):
			rotation += angular_speed * 1 * delta
		if Input.is_action_pressed("ui_up"):
			position += velocity * speed * delta
		if Input.is_action_pressed("ui_down"):
			position += velocity * speed * delta * -1
			

func _on_Button_pressed():
	if(motionIsOn == 0):
		motionIsOn = 1
	else:
		motionIsOn = 0



func _on_Timer_timeout():
	pass # Do nothing yet because I can't make it work!!

Thats how you would do it in 4.0, in 3.x its

timer.connect("timeout", self, "_on_timer_timeout")

you also forgot the _ in the beginning of _on_timer_timeout


This looks like the example in the docs, make sure you use the 3.5 docs instead of the stable ones.

Thank you very much!

I thought it might be that there was a difference with the version after searching and seeing the different syntax. Thanks for the link to the 3.5 docs. That will help greatly until I switch over to 4.0.

The missing underscore seems to have happened when I copied the code over to the forum. Not sure how that happened.