From c5da153e982317d8469ae3b17bf69ae1edde94c5 Mon Sep 17 00:00:00 2001 From: dariasteam Date: Tue, 19 Feb 2019 19:54:46 +0000 Subject: [PATCH] Restore the erased snippet --- Scenes/Player.gd | 11 +++++++++++ Scenes/segment.gd | 8 ++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/Scenes/Player.gd b/Scenes/Player.gd index 18b910c..59c45b5 100644 --- a/Scenes/Player.gd +++ b/Scenes/Player.gd @@ -119,6 +119,17 @@ func set_player_rotation (value): axis.set_rotation_deg(Vector3(0,value,0)) camera_axis.set_rotation_deg(Vector3(0,value,0)) +func end_animation(): + ball.hide() + rigid.set_linear_velocity(Vector3(0,0,0)) + rigid.set_gravity_scale(0) + rigid_2.set_linear_velocity(Vector3(0,0,0)) + rigid_2.set_gravity_scale(0) + idle_particles.set_emitting(false) + trail.set_emitting(false) + + die_particles.set_emitting(true) + func is_in_range (v, r_a, r_b): return v > r_a and v < r_b diff --git a/Scenes/segment.gd b/Scenes/segment.gd index 9c2d8f9..75fd4c5 100644 --- a/Scenes/segment.gd +++ b/Scenes/segment.gd @@ -17,8 +17,12 @@ func set_bad(): get_node("REGULAR/StaticBody").add_to_group("bad") func explode(): - get_node("REGULAR/StaticBody").queue_free() - get_node("REGULAR/AnimationPlayer").play("explode") + var a = get_node("REGULAR/StaticBody"); + if (a != null): + a.queue_free() + a = get_node("REGULAR/AnimationPlayer"); + if (a != null): + a.play("explode") func meteorize(): get_node("REGULAR/StaticBody").queue_free()