Hey, guys,

I've been testing some Godot features, and I'm having trouble understanding the Timer node. I attempted to send a signal to my player node, intending to print a debug message after 3 seconds, but the message never appears

[extends CharacterBody2D

var speed = 400

func process(delta):
var direction = Vector2(randi_range(-1,1), randi_range(-1,1))
random_move(direction )
$Timer.start()

func random_move(direction):
velocity = direction*speed
move_and_slide()

func _on_timer_timeout():
print("ok")
](https://)

  • xyz and DaveTheCoder replied to this.
  • Erediinnn $Timer.start()

    Try changing that to:

    if $Timer.is_stopped():
            $Timer.start()

    Without that check, the Timer is being restarted every few milliseconds and will never time out.

    Erediinnn Make sure that you actually connected timer's timeout signal to that signal handling function.

    Erediinnn $Timer.start()

    Try changing that to:

    if $Timer.is_stopped():
            $Timer.start()

    Without that check, the Timer is being restarted every few milliseconds and will never time out.