diff options
Diffstat (limited to '')
-rw-r--r-- | godot/assets/textures/circles.png | 3 | ||||
-rw-r--r-- | godot/assets/textures/circles.png.import | 3 | ||||
-rw-r--r-- | godot/scenes/Die.gd | 20 | ||||
-rw-r--r-- | godot/scenes/Die.tscn | 10 | ||||
-rw-r--r-- | godot/scenes/levels/MainMenu.tscn | 1 |
5 files changed, 32 insertions, 5 deletions
diff --git a/godot/assets/textures/circles.png b/godot/assets/textures/circles.png new file mode 100644 index 0000000..4e0f2a9 --- /dev/null +++ b/godot/assets/textures/circles.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bb7e9f2f5de95391413875ac0dd0f720543dbf69fab1f9635ce60ea6006687ae +size 74928 diff --git a/godot/assets/textures/circles.png.import b/godot/assets/textures/circles.png.import new file mode 100644 index 0000000..1a9ac1c --- /dev/null +++ b/godot/assets/textures/circles.png.import @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5bd9f3320ba422578d5b451a13f83dacf76effedf87905570a549c540c964341 +size 909 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. diff --git a/godot/scenes/Die.tscn b/godot/scenes/Die.tscn index 4e9cd2b..b2ad6da 100644 --- a/godot/scenes/Die.tscn +++ b/godot/scenes/Die.tscn @@ -1,7 +1,8 @@ -[gd_scene load_steps=9 format=2] +[gd_scene load_steps=10 format=2] [ext_resource path="res://scenes/Die.gd" type="Script" id=1] [ext_resource path="res://assets/game_objects/W8baseColor_Mat.material" type="Material" id=2] +[ext_resource path="res://assets/textures/circles.png" type="Texture" id=3] [sub_resource type="PhysicsMaterial" id=7] friction = 0.0 @@ -150,3 +151,10 @@ margin_bottom = 153.0 [node name="PowerUI3D" type="Spatial" parent="."] [node name="Arrow" type="MeshInstance" parent="PowerUI3D"] + +[node name="SpriteCircles" type="Sprite3D" parent="PowerUI3D"] +cast_shadow = 0 +opacity = 0.43 +pixel_size = 0.0071 +axis = 1 +texture = ExtResource( 3 ) diff --git a/godot/scenes/levels/MainMenu.tscn b/godot/scenes/levels/MainMenu.tscn index 438de12..77c50b1 100644 --- a/godot/scenes/levels/MainMenu.tscn +++ b/godot/scenes/levels/MainMenu.tscn @@ -58,6 +58,7 @@ script = ExtResource( 3 ) [node name="Camera" type="Camera" parent="."] transform = Transform( 1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0, 5, 0 ) +current = true [node name="AudioStreamPlayer2D" type="AudioStreamPlayer2D" parent="."] stream = ExtResource( 4 ) |