diff options
Diffstat (limited to 'godot/scenes/Die.gd')
-rw-r--r-- | godot/scenes/Die.gd | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/godot/scenes/Die.gd b/godot/scenes/Die.gd index 0cee70a..466366b 100644 --- a/godot/scenes/Die.gd +++ b/godot/scenes/Die.gd @@ -9,7 +9,9 @@ var cam_v_min = -90 var cam_v_max = 90 var sensitivity_cam = 0.5 var sensitivity_charge = 2 -var dice_is_moving = false +var dice_is_moving = true +var dice_is_still_since = 0 +var dice_still_timing = false var last_frame_position = Vector3(1.0,1.0,1.0) var mouse_origin = Vector2(0,0) var die_launch_force_magnitude = 0 @@ -115,9 +117,19 @@ func _physics_process(delta): $PowerUI3D.translation.y = translation.y $PowerUI3D.translation.z = translation.z - if dice_is_moving == true and angular_velocity.length() < 0.1 and linear_velocity.length() < 0.1: + if dice_is_moving == true and dice_still_timing == false and angular_velocity.length() < 0.1 and linear_velocity.length() < 0.1: + dice_is_still_since = OS.get_ticks_msec() + dice_still_timing = true + + elif dice_is_moving == false and angular_velocity.length() >= 0.1 and linear_velocity.length() >= 0.1: + dice_still_timing = false + dice_is_moving = true + $PowerUI3D/SpriteCircles.hide() + + if dice_still_timing == true && (OS.get_ticks_msec() - dice_is_still_since) > 200: if curr_buff != buff.ball: dice_is_moving = false + $PowerUI3D/SpriteCircles.show() revert_current_buff() var last_buff = curr_buff curr_buff = get_buff_from_upwards_side() @@ -125,8 +137,8 @@ func _physics_process(delta): return apply_buff() - elif dice_is_moving == false and angular_velocity.length() >= 0.1 and linear_velocity.length() >= 0.1: - dice_is_moving = true + + # Called every frame. 'delta' is the elapsed time since the previous frame. |