fixed tornado no-damage bug
parent
eeea6d2d59
commit
c3375d6305
|
|
@ -9,7 +9,6 @@ extends Area2D
|
|||
@onready var explosion_collision: CollisionShape2D = $ExplosionCollision
|
||||
|
||||
var _is_pulling := true
|
||||
var _damaged_enemies: Array[Node] = []
|
||||
|
||||
func _ready() -> void:
|
||||
tornado_area.disabled = false
|
||||
|
|
@ -31,15 +30,14 @@ func _physics_process(delta: float) -> void:
|
|||
|
||||
func _explode() -> void:
|
||||
_is_pulling = false
|
||||
var targets = get_overlapping_bodies().filter(func(b): return b.is_in_group("enemies") and not b.is_dying)
|
||||
tornado_area.disabled = true
|
||||
explosion_collision.disabled = false
|
||||
if animated_sprite_2d.sprite_frames.has_animation("explosion"):
|
||||
animated_sprite_2d.play("explosion")
|
||||
await get_tree().physics_frame
|
||||
for body in get_overlapping_bodies():
|
||||
if body.is_in_group("enemies") and not _damaged_enemies.has(body):
|
||||
for body in targets:
|
||||
if is_instance_valid(body):
|
||||
body.take_damage(explosion_damage)
|
||||
_damaged_enemies.append(body)
|
||||
if animated_sprite_2d.sprite_frames.has_animation("explosion"):
|
||||
await animated_sprite_2d.animation_finished
|
||||
else:
|
||||
|
|
|
|||
Loading…
Reference in New Issue