Enemies from Path won't trigger queue_free

If we check for path_follow.progress_ratio <= 0, due to the cyclic nature of the ratio, instead of being deleted it will continue to cycle, even though the actual enemy is destroyed by the deathzone if the path happens to go through it.

To ensure it gets destroyed, we can check for this instead:

#...
var prev_progress_ratio = 2
#...
func _process(delta):
	path_follow.progress_ratio -= 0.3 * delta
	if path_follow.progress_ratio >= prev_progress_ratio:
		queue_free()
	prev_progress_ratio = path_follow.progress_ratio
#...

Privacy & Terms