18 lines
411 B
GDScript
18 lines
411 B
GDScript
extends Area3D
|
|
|
|
var food_ready: bool = true
|
|
|
|
func _on_body_entered(body: Node3D) -> void:
|
|
if body.has_method("heal") and food_ready == true:
|
|
$cookie_model.visible = false
|
|
food_ready = false
|
|
body.heal()
|
|
%RespawnTimer.start()
|
|
else:
|
|
print(str(body) + " wants to eat a cookie, but doesn't know how!")
|
|
return
|
|
|
|
func _on_respawn_timer_timeout() -> void:
|
|
food_ready = true
|
|
$cookie_model.visible = true
|