blob: ee38b6187b5a9b80979558f3fbd81f357585382d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
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()
|