fuzzyworld

godot-shooter / asteroids / files / weapons / Bomb.gd

Branch asteroids · default branch · all branches

Bomb.gd

375 B · history · blame

1extends Node2D
2
3var hurt_enemies = []
4export var damage_amount = 50
5
6func _ready() -> void:
7 $AnimationPlayer.play("explode")
8 pass # Replace with function body.
9
10func _on_Area2D_body_entered(body: Node) -> void:
11 if body is Enemy:
12 var already_hurt_enemy = hurt_enemies.has(body)
13 if already_hurt_enemy:
14 return
15 hurt_enemies.push_back(body)
16 body.hurt(damage_amount)