1
Fork 0
mirror of https://github.com/Steffo99/pineapple-surf.git synced 2024-11-28 18:54:19 +00:00

Fix CropTile behaviour

This commit is contained in:
Steffo 2023-01-08 13:09:34 +01:00
parent 076fdb62c5
commit 41297e5ed4
Signed by: steffo
GPG key ID: 6965406171929D01
2 changed files with 7 additions and 6 deletions

View file

@ -20,21 +20,21 @@ signal on_complete()
func plant(): func plant():
if growth_timer.is_stopped(): if growth_timer.is_stopped():
growth_timer.start() growth_timer.start()
producer.produce_with_random_force()
emit_signal("on_planted") emit_signal("on_planted")
func complete(): func complete():
if not growth_timer.is_stopped(): pop_sound.play_with_random_pitch()
growth_timer.stop() producer.produce_with_random_force()
pop_sound.play_with_random_pitch() emit_signal("on_complete")
emit_signal("on_complete")
if debug_growth: if debug_growth:
plant() plant()
func _process(_delta): func _process(_delta):
var scale_factor = 1 - (growth_timer.time_left / growth_timer.wait_time) var scale_factor = 0
if not growth_timer.is_stopped():
scale_factor = 1 - (growth_timer.time_left / growth_timer.wait_time)
sprout_mesh.scale = Vector3(scale_factor, scale_factor, scale_factor) sprout_mesh.scale = Vector3(scale_factor, scale_factor, scale_factor)

View file

@ -44,6 +44,7 @@ skeleton = NodePath("../../..")
[node name="GrowthTimer" type="Timer" parent="."] [node name="GrowthTimer" type="Timer" parent="."]
wait_time = 2.0 wait_time = 2.0
one_shot = true
[node name="Pop" type="AudioStreamPlayer3D" parent="."] [node name="Pop" type="AudioStreamPlayer3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.5, 0.1, 0.5) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.5, 0.1, 0.5)