the-crypt/magic/Projectiles/ExplosiveProjectile.gd
2020-07-20 01:18:45 -05:00

18 lines
395 B
GDScript

extends Projectile
func _ready():
damage = 3
func on_impact(collision):
for body in $Area2D.get_overlapping_bodies():
if body.get("health") != null and body.get_type() != "player":
body.health -= damage
$Particles2D.emitting = true
$KillTimer.start()
set_physics_process(false)
$CollisionShape2D.disabled = true
$Sprite.visible = false
func _on_KillTimer_timeout():
queue_free()