My first 3D game with Godot 4.4
This commit is contained in:
17
player/cookie_3d.gd
Normal file
17
player/cookie_3d.gd
Normal file
@@ -0,0 +1,17 @@
|
||||
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
|
||||
Reference in New Issue
Block a user