fuzzyworld

godot-shooter / files / weapons / Bomb.gd

Bomb.gd

Blame: the commit that last changed each line · file · history

93d86765 2023-11-17 Pavel Safronov1extends 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)
f85124dd 2023-11-17 Pavel Safronov13 if already_hurt_enemy:
14 return
93d86765 2023-11-17 Pavel Safronov15 hurt_enemies.push_back(body)
16 body.hurt(damage_amount)