In that case, I'd set the Timer node with oneshot enabled, so it only fires once, and use the timeout signal to respawn the enemy. However, even if the enemy is not visible, it will still call _process
/_physics_process
, so you need to disable that as well:
extends KinematicBody
var health = 1
func _process(delta):
if health <= 0:
visible = false
$Timer.start()
set_process(false)
func _on_Timer_timeout():
health = 100
visible = true
set_process(true)
Also there's no need to set each object's visible
property individually like you're doing. If the parent node is hidden, all it's children will be hidden from the game.