system
November 12, 2022, 11:31pm
1
Attention
Topic was automatically imported from the old Question2Answer platform.
Asked By
LyguN
I have an enemy with a timer attached to it. When the player attacks the enemy, it dies and gets destroyed, and that is when this error gets fired. Everything works fine and does as expected but this error is just a bit annoying. Here’s the code:
onready var idleTimer = $IdleTimer
func _on_DetectionArea_body_entered(body):
idleTimer.stop()
if isActive == false:
animSprite.play("Wakeup")
yield(animSprite,"animation_finished")
animSprite.play("Active")
isActive = true
func _on_DetectionArea_body_exited(body):
idleTimer.start()
func _on_IdleTimer_timeout():
if $DetectionArea.get_overlapping_areas():
idleTimer.stop()
else:
isActive = false
animSprite.play("Death")
yield(animSprite, "animation_finished")
animSprite.play("Idle")
func _on_Hurtbox_area_entered(area):
animSprite.play("Death")
$Hurtbox.set_deferred("monitoring", false)
$Hitbox.set_deferred("monitorable", false)
yield(animSprite, "animation_finished")
queue_free()
system
March 2, 2023, 9:24pm
2
Reply From:
jeudyx
This is a super weird one. Instead of calling .start(), set autostart = true
opened 12:55AM - 27 Nov 19 UTC
closed 07:50PM - 27 Nov 19 UTC
discussion
topic:core
**Godot version:** 3.2 beta2
**OS/device including version:** Windows 10
*… *Issue description:** Overzealous error (?)
**Steps to reproduce:** call start() on a timer prior to add the timer to the scene tree
For now the biggest pain when porting an existing project to 3.2. Timer.start() is called in the constructor in several objects, which then are added in the scene tree. This workflow was working fine in 3.1. Fixing this is a pain, as it requires a convoluted logic to start the timer later (it is not as simple as this, since the timer is not always started, depending on some state).
On the other side, this error seems to only prevent forgetting adding a started timer to the scene. But then it would only result in the timer never timing out, right? This seems easy to detect when coding, and should not trigger an error IMO.
So I would like to know if you would consider removing this error...
Just had the same issue.
I did this and it still dosen’t work, the Timer dosen’t timeout at all.
javrocks | 2023-06-28 00:30