summaryrefslogtreecommitdiff
path: root/Scripts/Level Specific/1FruitSrhubs.gd
diff options
context:
space:
mode:
Diffstat (limited to 'Scripts/Level Specific/1FruitSrhubs.gd')
-rw-r--r--Scripts/Level Specific/1FruitSrhubs.gd14
1 files changed, 14 insertions, 0 deletions
diff --git a/Scripts/Level Specific/1FruitSrhubs.gd b/Scripts/Level Specific/1FruitSrhubs.gd
new file mode 100644
index 0000000..ee38b61
--- /dev/null
+++ b/Scripts/Level Specific/1FruitSrhubs.gd
@@ -0,0 +1,14 @@
+extends Node2D
+
+@export var area : Area2D
+@export var fruites : Node2D
+@export var health = 3
+
+func _on_area_2d_body_entered(body:Node2D) -> void:
+ if body is Entity:
+ if body.is_player:
+ body.health += health
+ body.health = min(body.health, body.max_health)
+ UIConnector.display_health(body.health)
+ area.queue_free()
+ fruites.queue_free()