Revised downswing animation & gauge effects

This commit is contained in:
Rob Kelly 2024-11-21 17:19:06 -07:00
parent 1a622ff3b1
commit ed91c9c9d8
12 changed files with 969 additions and 889 deletions

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -165,11 +165,8 @@ bones/22/scale = Vector3(1, 1, 1)
bones/23/rotation = Quaternion(0.000222673, 0.707107, 0.707107, -0.000222504)
bones/23/scale = Vector3(1, 1, 1)
[node name="Eyes_Closed" parent="Armature/Skeleton3D" index="1"]
visible = false
[node name="BoneAttachment3D" type="BoneAttachment3D" parent="Armature/Skeleton3D" index="6"]
transform = Transform3D(-0.0322545, -0.997872, -0.0566733, 0.99947, -0.0324594, 0.00269896, -0.00453261, -0.0565562, 0.998389, -2.5177, 5.22011, -0.516371)
transform = Transform3D(-0.949594, 0.297848, -0.0977661, -0.313159, -0.915477, 0.25265, -0.0142512, 0.270532, 0.962605, -0.14033, 3.24759, 0.85525)
bone_name = "Hand.R"
bone_idx = 11
@ -179,7 +176,6 @@ transform = Transform3D(0.934826, 0.266239, -0.23498, -0.336326, 0.876157, -0.34
[node name="ReferenceClub" type="MeshInstance3D" parent="Armature/Skeleton3D/BoneAttachment3D/RightHandGrip" index="0"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.205, 0)
visible = false
mesh = SubResource("BoxMesh_363n0")
skeleton = NodePath("../..")

View File

@ -154,6 +154,7 @@ var _tracking_camera: OrbitalCamera
@onready var putt_ref: RayCast3D = %PuttRef
@onready var putt_arrow: Node3D = %PuttArrow
@onready var downswing_timer: Timer = %DownswingTimer
@onready var ball_return_timer: Timer = %BallReturnTimer
@onready var camera_distance := zoom.position.z:
@ -416,10 +417,9 @@ func _on_phase_change(new_phase: Phase) -> void:
hud.curve_bar.show()
hud.start_curve_bar()
Phase.DOWNSWING:
hud.power_bar.hide()
hud.curve_bar.hide()
hud.gauge_flourish()
character.downswing()
shot_animation.play("swing_delay") # calls `take_shot`
downswing_timer.start()
Phase.SHOT:
hud.power_bar.hide()
hud.curve_bar.hide()

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=17 format=3 uid="uid://cy7t2tc4y3b4"]
[gd_scene load_steps=16 format=3 uid="uid://cy7t2tc4y3b4"]
[ext_resource type="Script" path="res://src/player/shot_setup/shot_setup.gd" id="1_r6ei4"]
[ext_resource type="Script" path="res://src/player/shot_setup/ball_point.gd" id="2_e6i3g"]
@ -169,30 +169,10 @@ tracks/2/keys = {
}]
}
[sub_resource type="Animation" id="Animation_u8k07"]
resource_name = "swing_delay"
length = 0.0667
step = 0.01
tracks/0/type = "method"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("%Direction/..")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0.0667),
"transitions": PackedFloat32Array(1),
"values": [{
"args": [],
"method": &"finish_downswing"
}]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_u78hq"]
_data = {
"RESET": SubResource("Animation_oks0y"),
"shoot": SubResource("Animation_e65hh"),
"swing_delay": SubResource("Animation_u8k07")
"shoot": SubResource("Animation_e65hh")
}
[sub_resource type="SphereShape3D" id="SphereShape3D_xvvdi"]
@ -340,6 +320,11 @@ libraries = {
"": SubResource("AnimationLibrary_u78hq")
}
[node name="DownswingTimer" type="Timer" parent="."]
unique_name_in_owner = true
wait_time = 0.42
one_shot = true
[node name="BallReturnTimer" type="Timer" parent="."]
unique_name_in_owner = true
one_shot = true
@ -351,6 +336,7 @@ script = ExtResource("7_uh8kn")
shape = SubResource("SphereShape3D_xvvdi")
[connection signal="ball_changed" from="BallPoint" to="." method="_on_game_ball_changed"]
[connection signal="timeout" from="DownswingTimer" to="." method="finish_downswing"]
[connection signal="timeout" from="BallReturnTimer" to="." method="_on_ball_return_timer_timeout"]
[connection signal="ball_collision" from="Hitbox" to="." method="_on_hitbox_ball_collision"]
[connection signal="body_entered" from="Hitbox" to="Hitbox" method="_on_body_entered"]

View File

@ -0,0 +1,9 @@
shader_type canvas_item;
uniform vec4 flash_color: source_color = vec4(1.0);
void fragment() {
vec4 base_color = texture(TEXTURE, UV);
COLOR.rgb = mix(base_color.rgb, flash_color.rgb, flash_color.a);
COLOR.a = base_color.a;
}

View File

@ -20,7 +20,12 @@ const PIVOT_SCALE := -PI / 4
@onready var pivot: Control = %Pivot
@onready var gradient_fill: TextureRect = %GradientFill
@onready var gradient_tex: GradientTexture2D = gradient_fill.texture
@onready var animation_player: AnimationPlayer = $Reticle/AnimationPlayer
func _ready() -> void:
gradient = gradient
func flourish() -> void:
animation_player.play("flourish")

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=6 format=3 uid="uid://mm02j126jo1h"]
[gd_scene load_steps=9 format=3 uid="uid://mm02j126jo1h"]
[ext_resource type="Script" path="res://src/ui/shot_hud/curve_bar/curve_bar.gd" id="1_aqvdi"]
[ext_resource type="Gradient" uid="uid://k7867gxaxx57" path="res://src/ui/shot_hud/curve_bar/one_sided_gradient.tres" id="2_f3fom"]
@ -14,52 +14,117 @@ fill_from = Vector2(0.5, 0.02)
fill_to = Vector2(0.5, 0.37)
metadata/_snap_enabled = true
[sub_resource type="Animation" id="Animation_pt3no"]
resource_name = "flourish"
length = 0.42
step = 0.01
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Reticle:rotation")
tracks/0/interp = 2
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.42),
"transitions": PackedFloat32Array(1.618, 1),
"update": 0,
"values": [0.0, 6.28319]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("Reticle:scale")
tracks/1/interp = 2
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0, 0.0333333, 0.2, 0.42),
"transitions": PackedFloat32Array(1, 1.618, 1.618, 1),
"update": 0,
"values": [Vector2(1, 1), Vector2(0.6, 0.6), Vector2(2, 2), Vector2(1, 1)]
}
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("Pivot/ArcBG:color")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0, 0.105, 0.21, 0.315, 0.42),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1),
"update": 0,
"values": [Color(0.0352941, 0.0784314, 0.160784, 0.784314), Color(1, 1, 1, 1), Color(0.0352941, 0.0784314, 0.160784, 0.784314), Color(1, 1, 1, 1), Color(0.0352941, 0.0784314, 0.160784, 0.784314)]
}
[sub_resource type="Animation" id="Animation_kfg2n"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Reticle:rotation")
tracks/0/interp = 2
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [0.0]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("Reticle:scale")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Vector2(1, 1)]
}
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("Pivot/ArcBG:color")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Color(0.0352941, 0.0784314, 0.160784, 0.784314)]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_eqkfk"]
_data = {
"RESET": SubResource("Animation_kfg2n"),
"flourish": SubResource("Animation_pt3no")
}
[node name="CurveBar" type="Control"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_aqvdi")
gradient = ExtResource("2_f3fom")
[node name="Reticle" type="TextureRect" parent="."]
texture_filter = 1
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -20.0
offset_top = -20.0
offset_right = 20.0
offset_bottom = 20.0
grow_horizontal = 2
grow_vertical = 2
texture = ExtResource("3_2tv33")
[node name="Pivot" type="Control" parent="Reticle"]
[node name="Pivot" type="Control" parent="."]
unique_name_in_owner = true
show_behind_parent = true
texture_filter = 6
custom_minimum_size = Vector2(600, 600)
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
anchors_preset = 0
offset_left = -300.0
offset_top = -32.0
offset_right = 300.0
offset_bottom = 568.0
grow_horizontal = 2
grow_vertical = 2
pivot_offset = Vector2(300, 300)
[node name="ArcBG" type="Control" parent="Reticle/Pivot"]
[node name="ArcBG" type="Control" parent="Pivot"]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
@ -72,7 +137,7 @@ arc_end = -0.785398
width = 32.0
color = Color(0.0352941, 0.0784314, 0.160784, 0.784314)
[node name="MarginContainer" type="MarginContainer" parent="Reticle/Pivot"]
[node name="MarginContainer" type="MarginContainer" parent="Pivot"]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
@ -84,7 +149,7 @@ theme_override_constants/margin_top = 3
theme_override_constants/margin_right = 3
theme_override_constants/margin_bottom = 3
[node name="ArcFill" type="Control" parent="Reticle/Pivot/MarginContainer"]
[node name="ArcFill" type="Control" parent="Pivot/MarginContainer"]
clip_children = 1
layout_mode = 2
script = ExtResource("4_s2bpl")
@ -92,7 +157,7 @@ arc_start = -2.35619
arc_end = -0.785398
width = 26.0
[node name="GradientFill" type="TextureRect" parent="Reticle/Pivot/MarginContainer/ArcFill"]
[node name="GradientFill" type="TextureRect" parent="Pivot/MarginContainer/ArcFill"]
unique_name_in_owner = true
layout_mode = 1
anchors_preset = 15
@ -101,3 +166,19 @@ anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
texture = SubResource("GradientTexture2D_o88ik")
[node name="Reticle" type="TextureRect" parent="."]
texture_filter = 1
layout_mode = 0
offset_left = -20.0
offset_top = -20.0
offset_right = 20.0
offset_bottom = 20.0
pivot_offset = Vector2(20, 20)
texture = ExtResource("3_2tv33")
[node name="AnimationPlayer" type="AnimationPlayer" parent="Reticle"]
root_node = NodePath("../..")
libraries = {
"": SubResource("AnimationLibrary_eqkfk")
}

View File

@ -81,6 +81,10 @@ func reset_curve_bar() -> void:
_curve_animation.stop()
func gauge_flourish() -> void:
curve_bar.flourish()
func play_nice_animation() -> void:
_nice_animation.play("display")

View File

@ -671,7 +671,6 @@ script = ExtResource("3_6groq")
[node name="PowerBar" type="TextureProgressBar" parent="ShotGauges/PowerGauge/Rumbler"]
unique_name_in_owner = true
visible = false
texture_filter = 5
custom_minimum_size = Vector2(64, 0)
layout_mode = 1