15 lines
359 B
GDScript
15 lines
359 B
GDScript
extends Area2D
|
|
|
|
@export_enum("AP", "HE") var ammo_type: int = 0
|
|
@export var amount: int = 10
|
|
|
|
func _ready():
|
|
body_entered.connect(_on_body_entered)
|
|
|
|
func _on_body_entered(body):
|
|
if body.is_in_group("player"):
|
|
var turret = body.get_node_or_null("turret")
|
|
if turret and turret.has_method("add_ammo"):
|
|
turret.add_ammo(ammo_type, amount)
|
|
queue_free()
|