fix another arrow crash (closes #72)
This commit is contained in:
parent
563bb46a44
commit
094584e1b7
1 changed files with 19 additions and 17 deletions
|
@ -59,22 +59,24 @@ func _on_Hitbox_area_entered(area):
|
|||
queue_free()
|
||||
|
||||
func _persist_trail():
|
||||
var particles = $DustParticles
|
||||
remove_child(particles)
|
||||
get_parent().add_child(particles)
|
||||
particles.global_position = global_position
|
||||
particles.emitting = false
|
||||
get_tree().create_timer(particles.lifetime, false).connect("timeout", particles, "queue_free")
|
||||
# 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
|
||||
|
||||
var particles = $SparkParticles
|
||||
remove_child(particles)
|
||||
particles.global_position = global_position + particles.position * scale.x
|
||||
particles.emitting = true
|
||||
get_parent().add_child(particles)
|
||||
var timer = get_tree().create_timer(particles.lifetime, false)
|
||||
timer.connect("timeout", particles, "queue_free")
|
||||
# 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
|
||||
particles.emitting = true
|
||||
get_parent().add_child(particles)
|
||||
var timer = get_tree().create_timer(particles.lifetime, false)
|
||||
timer.connect("timeout", particles, "queue_free")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue