fix another arrow crash (closes #72)

This commit is contained in:
Haze Weathers 2023-03-22 11:53:16 -04:00
parent 563bb46a44
commit 094584e1b7

View file

@ -59,18 +59,20 @@ func _on_Hitbox_area_entered(area):
queue_free()
func _persist_trail():
# don't do this twice to prevent crash
if not is_queued_for_deletion():
# make particles a sibling so it lives a bit longer than arrow
var particles = $DustParticles
remove_child(particles)
get_parent().add_child(particles)
particles.global_position = global_position
particles.emitting = false
# free particles once they have gone through their lifetime
get_tree().create_timer(particles.lifetime, false).connect("timeout", particles, "queue_free")
func _make_sparks():
# return if this has already happened to avoid crash
if is_queued_for_deletion():
return
# don't do this twice to prevent crash
if not is_queued_for_deletion():
var particles = $SparkParticles
remove_child(particles)
particles.global_position = global_position + particles.position * scale.x