aboutsummaryrefslogtreecommitdiffstats
path: root/godot/scenes/Die.gd
diff options
context:
space:
mode:
authorLibravatar David <david003@gmx.net>2022-07-17 14:45:57 +0200
committerLibravatar David <david003@gmx.net>2022-07-17 14:45:57 +0200
commit1b015a5989a3da04f08aaa06db444c875ea97df1 (patch)
treeef83a959cea5fd37ac4d8d5cc063d93cac165674 /godot/scenes/Die.gd
parent78db85704fc13f3bde69fdad196f6701a4d5e7c9 (diff)
download2022-1b015a5989a3da04f08aaa06db444c875ea97df1.tar.gz
2022-1b015a5989a3da04f08aaa06db444c875ea97df1.tar.bz2
2022-1b015a5989a3da04f08aaa06db444c875ea97df1.zip
add reticle when die is still.
die is still after 200ms
Diffstat (limited to 'godot/scenes/Die.gd')
-rw-r--r--godot/scenes/Die.gd20
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.