28 lines
698 B
GDScript
28 lines
698 B
GDScript
extends Spatial
|
|
|
|
export var grow_time: float = 2.0
|
|
|
|
func _ready():
|
|
$grow_timer.wait_time = grow_time
|
|
|
|
func _on_coin_machine_coin_requirement_met(player):
|
|
if $grow_timer.is_stopped():
|
|
$coin_machine.enabled = false
|
|
$grow_timer.start()
|
|
|
|
func _on_Timer_timeout():
|
|
var yam = preload("res://scenes/item_pickup.tscn").instance()
|
|
yam.item_name = "yam"
|
|
yam.item_amount = 1
|
|
yam.connect("tree_exited", self, "_on_yam_item_tree_exited")
|
|
$MeshInstance/Yam.visible = true
|
|
add_child(yam)
|
|
|
|
func _on_yam_item_tree_exited():
|
|
$coin_machine.enabled = true
|
|
$MeshInstance/Yam.visible = false
|
|
add_child(Dialogic.start("yamget"))
|
|
|
|
func _process(delta):
|
|
$"%status_label".text = "%f" % $grow_timer.time_left
|