12 lines
241 B
GDScript
12 lines
241 B
GDScript
extends Area2D
|
|
|
|
var _durability: int = 3
|
|
|
|
func _on_body_entered(body: Node2D) -> void:
|
|
if body is Character:
|
|
_durability -= 1
|
|
body.repel_collision(self)
|
|
if _durability <= 0:
|
|
Inventory.add_item(Inventory.Wood.new())
|
|
queue_free()
|