2020-07-20 16:36:28 -05:00
|
|
|
extends Projectile
|
|
|
|
|
|
|
|
func _ready():
|
|
|
|
energy_cost = 2
|
|
|
|
damage = 1
|
2020-07-20 23:24:09 -05:00
|
|
|
|
|
|
|
|
|
|
|
func on_impact(collision):
|
|
|
|
if collision.collider.has_method("get_type") && collision.collider.get_type() == "enemy":
|
|
|
|
var c = collision.collider
|
|
|
|
c.health -= damage * damage_mod
|
|
|
|
c.do_knockback(collision.normal)
|
2020-07-21 15:00:32 -05:00
|
|
|
c.play_hit()
|
2020-07-20 23:24:09 -05:00
|
|
|
queue_free()
|
|
|
|
elif bounces_left != 0:
|
|
|
|
bounces_left -= 1
|
|
|
|
look_at(position + velocity.bounce(collision.normal))
|
2020-07-21 15:00:32 -05:00
|
|
|
launch(null)
|
2020-07-20 23:24:09 -05:00
|
|
|
else:
|
|
|
|
queue_free()
|