generated from krampus/template-godot4
Club select with neat little UI widget
This commit is contained in:
parent
d3f076506c
commit
9337a63b69
|
@ -112,6 +112,31 @@ shot_accept={
|
|||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":32,"key_label":0,"unicode":32,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
select_driver={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":49,"key_label":0,"unicode":49,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
select_iron={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":50,"key_label":0,"unicode":50,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
select_wedge={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":51,"key_label":0,"unicode":51,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
select_gold={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":52,"key_label":0,"unicode":52,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
select_putter={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":53,"key_label":0,"unicode":53,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
|
||||
[layer_names]
|
||||
|
||||
|
|
|
@ -0,0 +1,69 @@
|
|||
@tool
|
||||
class_name ClubSelector extends Control
|
||||
|
||||
const UNSELECTED_SCALE := Vector2(0.618, 0.618)
|
||||
const SELECTED_SCALE := Vector2(1.0, 1.0)
|
||||
|
||||
const LABEL_SCALE_TIME := 0.3
|
||||
const HUB_ROTATION_TIME := 0.2
|
||||
|
||||
const CLUB_ROTATION := {
|
||||
T.Club.DRIVER: 0.0,
|
||||
T.Club.IRON: -16.0,
|
||||
T.Club.WEDGE: -32.0,
|
||||
T.Club.GOLD: -48.0,
|
||||
T.Club.PUTTER: -64.0,
|
||||
}
|
||||
|
||||
@export var value: T.Club:
|
||||
set = _set_value
|
||||
|
||||
@onready var club_hub: Control = %ClubHub
|
||||
|
||||
@onready var driver_label: Label = %DriverLabel
|
||||
@onready var iron_label: Label = %IronLabel
|
||||
@onready var wedge_label: Label = %WedgeLabel
|
||||
@onready var gold_label: Label = %GoldLabel
|
||||
@onready var putter_label: Label = %PutterLabel
|
||||
|
||||
|
||||
func _get_club_label(club: T.Club) -> Label:
|
||||
match club:
|
||||
T.Club.DRIVER:
|
||||
return driver_label
|
||||
T.Club.IRON:
|
||||
return iron_label
|
||||
T.Club.WEDGE:
|
||||
return wedge_label
|
||||
T.Club.GOLD:
|
||||
return gold_label
|
||||
T.Club.PUTTER:
|
||||
return putter_label
|
||||
assert(false, "Unknown club %d" % club)
|
||||
return
|
||||
|
||||
|
||||
func _reset_label_scale() -> void:
|
||||
for c: Control in club_hub.get_children():
|
||||
c.scale = UNSELECTED_SCALE
|
||||
|
||||
|
||||
func _set_value(new_value: T.Club) -> void:
|
||||
#_reset_label_scale()
|
||||
var old_label := _get_club_label(value)
|
||||
var new_label := _get_club_label(new_value)
|
||||
var hub_rotation: float = CLUB_ROTATION[new_value]
|
||||
|
||||
var tween := get_tree().create_tween()
|
||||
tween.set_parallel()
|
||||
tween.tween_property(old_label, "scale", UNSELECTED_SCALE, LABEL_SCALE_TIME).set_trans(
|
||||
Tween.TRANS_SINE
|
||||
)
|
||||
tween.tween_property(new_label, "scale", SELECTED_SCALE, LABEL_SCALE_TIME).set_trans(
|
||||
Tween.TRANS_SINE
|
||||
)
|
||||
tween.tween_property(club_hub, "rotation_degrees", hub_rotation, HUB_ROTATION_TIME).set_trans(
|
||||
Tween.TRANS_QUAD
|
||||
)
|
||||
|
||||
value = new_value
|
|
@ -0,0 +1,184 @@
|
|||
[gd_scene load_steps=7 format=3 uid="uid://445qd7m4qe2j"]
|
||||
|
||||
[ext_resource type="Script" path="res://src/player/shot_setup/club_selector/club_selector.gd" id="1_cttgc"]
|
||||
[ext_resource type="Script" path="res://src/ui/decorations/arc.gd" id="2_vijl7"]
|
||||
[ext_resource type="Script" path="res://src/ui/double_rotator.gd" id="3_0ptmq"]
|
||||
|
||||
[sub_resource type="Animation" id="Animation_crn6i"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath(".:rotation")
|
||||
tracks/0/interp = 3
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [0.0]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_f0o2h"]
|
||||
resource_name = "rotate"
|
||||
length = 8.0
|
||||
loop_mode = 1
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath(".:rotation")
|
||||
tracks/0/interp = 3
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 2, 4, 6, 8),
|
||||
"transitions": PackedFloat32Array(1, 1, 1, 1, 1),
|
||||
"update": 0,
|
||||
"values": [0.0, 1.5708, 3.14159, 4.71239, 6.28319]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_3muuc"]
|
||||
_data = {
|
||||
"RESET": SubResource("Animation_crn6i"),
|
||||
"rotate": SubResource("Animation_f0o2h")
|
||||
}
|
||||
|
||||
[node name="ClubSelector" type="Control"]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_cttgc")
|
||||
|
||||
[node name="Arc" type="Control" parent="."]
|
||||
custom_minimum_size = Vector2(200, 200)
|
||||
layout_mode = 1
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -100.0
|
||||
offset_top = -100.0
|
||||
offset_right = 100.0
|
||||
offset_bottom = 100.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
pivot_offset = Vector2(100, 100)
|
||||
script = ExtResource("2_vijl7")
|
||||
gap_angle = 0.6
|
||||
width = 6.0
|
||||
color = Color(0, 0, 0, 0.392157)
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="Arc"]
|
||||
libraries = {
|
||||
"": SubResource("AnimationLibrary_3muuc")
|
||||
}
|
||||
autoplay = "rotate"
|
||||
|
||||
[node name="ClubHub" type="Control" parent="."]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 1
|
||||
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("3_0ptmq")
|
||||
|
||||
[node name="DriverLabel" type="Label" parent="ClubHub"]
|
||||
unique_name_in_owner = true
|
||||
texture_filter = 6
|
||||
layout_mode = 1
|
||||
anchors_preset = -1
|
||||
anchor_left = 1.0
|
||||
anchor_top = 0.5
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 0.5
|
||||
offset_left = 120.0
|
||||
offset_top = -17.0
|
||||
offset_right = 206.0
|
||||
offset_bottom = 17.0
|
||||
grow_vertical = 2
|
||||
pivot_offset = Vector2(0, 20)
|
||||
theme_type_variation = &"ClubSelectLabel"
|
||||
text = "DRIVER"
|
||||
|
||||
[node name="IronLabel" type="Label" parent="ClubHub"]
|
||||
unique_name_in_owner = true
|
||||
texture_filter = 6
|
||||
layout_mode = 1
|
||||
anchors_preset = -1
|
||||
anchor_left = 1.0
|
||||
anchor_top = 0.5
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 0.5
|
||||
offset_left = 120.037
|
||||
offset_top = 14.235
|
||||
offset_right = 193.037
|
||||
offset_bottom = 53.235
|
||||
grow_vertical = 2
|
||||
scale = Vector2(0.618, 0.618)
|
||||
pivot_offset = Vector2(0, 20)
|
||||
theme_type_variation = &"ClubSelectLabel"
|
||||
text = "IRON"
|
||||
|
||||
[node name="WedgeLabel" type="Label" parent="ClubHub"]
|
||||
unique_name_in_owner = true
|
||||
texture_filter = 6
|
||||
layout_mode = 1
|
||||
anchors_preset = -1
|
||||
anchor_left = 1.0
|
||||
anchor_top = 0.5
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 0.5
|
||||
offset_left = 110.774
|
||||
offset_top = 49.1735
|
||||
offset_right = 193.774
|
||||
offset_bottom = 83.1735
|
||||
grow_vertical = 2
|
||||
scale = Vector2(0.618, 0.618)
|
||||
pivot_offset = Vector2(0, 20)
|
||||
theme_type_variation = &"ClubSelectLabel"
|
||||
text = "WEDGE"
|
||||
|
||||
[node name="GoldLabel" type="Label" parent="ClubHub"]
|
||||
unique_name_in_owner = true
|
||||
texture_filter = 6
|
||||
layout_mode = 1
|
||||
anchors_preset = -1
|
||||
anchor_left = 1.0
|
||||
anchor_top = 0.5
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 0.5
|
||||
offset_left = 92.9291
|
||||
offset_top = 77.8023
|
||||
offset_right = 156.929
|
||||
offset_bottom = 111.802
|
||||
grow_vertical = 2
|
||||
scale = Vector2(0.618, 0.618)
|
||||
pivot_offset = Vector2(0, 20)
|
||||
theme_type_variation = &"ClubSelectLabel"
|
||||
text = "GOLD"
|
||||
|
||||
[node name="PutterLabel" type="Label" parent="ClubHub"]
|
||||
unique_name_in_owner = true
|
||||
texture_filter = 6
|
||||
layout_mode = 1
|
||||
anchors_preset = -1
|
||||
anchor_left = 1.0
|
||||
anchor_top = 0.5
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 0.5
|
||||
offset_left = 67.8836
|
||||
offset_top = 97.903
|
||||
offset_right = 169.884
|
||||
offset_bottom = 136.903
|
||||
grow_vertical = 2
|
||||
scale = Vector2(0.618, 0.618)
|
||||
pivot_offset = Vector2(0, 20)
|
||||
theme_type_variation = &"ClubSelectLabel"
|
||||
text = "PUTTER"
|
|
@ -55,6 +55,14 @@ var phase: Phase:
|
|||
_on_phase_change(value)
|
||||
phase = value
|
||||
|
||||
var club: T.Club:
|
||||
set(value):
|
||||
if value != club:
|
||||
_on_club_change(value)
|
||||
club = value
|
||||
|
||||
var shot_ref: Node3D
|
||||
|
||||
var _free_camera: FreeCamera
|
||||
var _returning_free_camera := false
|
||||
|
||||
|
@ -81,6 +89,10 @@ var _returning_free_camera := false
|
|||
@onready var physics_ball: RigidBody3D = %PhysicsBall
|
||||
|
||||
@onready var drive_ref: RayCast3D = %DriveRef
|
||||
@onready var drive_arrow: Node3D = %DriveArrow
|
||||
@onready var putt_ref: RayCast3D = %PuttRef
|
||||
@onready var putt_arrow: Node3D = %PuttArrow
|
||||
@onready var club_selector: ClubSelector = %ClubSelector
|
||||
|
||||
@onready var nice_animation: AnimationPlayer = %NiceAnimation
|
||||
|
||||
|
@ -92,6 +104,11 @@ var _returning_free_camera := false
|
|||
@onready var _target_rotation := Vector2(pitch.rotation.x, direction.rotation.y)
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
_on_phase_change(phase)
|
||||
_on_club_change(club)
|
||||
|
||||
|
||||
func _set_camera_distance(value: float) -> void:
|
||||
var tween := get_tree().create_tween()
|
||||
tween.tween_property(zoom, "position:z", value, ZOOM_LENGTH).set_trans(Tween.TRANS_SINE)
|
||||
|
@ -128,7 +145,7 @@ func take_shot() -> void:
|
|||
print("Power: ", power_bar.value)
|
||||
print("Curve: ", curve_bar.value)
|
||||
|
||||
var impulse := drive_ref.global_basis * Vector3.ONE * base_power
|
||||
var impulse := shot_ref.global_basis * Vector3.ONE * base_power * power_bar.value
|
||||
print("Shot impulse: ", impulse)
|
||||
|
||||
physics_ball.freeze = false
|
||||
|
@ -178,9 +195,10 @@ func travel_to_ball() -> void:
|
|||
func start_shot_track() -> void:
|
||||
#tracking_camera.make_current()
|
||||
#tracking_camera.active = true
|
||||
var orbital_cam := OrbitalCamera.create(physics_ball)
|
||||
orbital_cam.rotation.y = randf_range(0.0, TAU)
|
||||
add_sibling(orbital_cam)
|
||||
if phase == Phase.SHOT:
|
||||
var orbital_cam := OrbitalCamera.create(physics_ball)
|
||||
orbital_cam.rotation.y = randf_range(0.0, TAU)
|
||||
add_sibling(orbital_cam)
|
||||
|
||||
|
||||
func end_shot_track() -> void:
|
||||
|
@ -188,6 +206,21 @@ func end_shot_track() -> void:
|
|||
#tracking_camera.active = false
|
||||
|
||||
|
||||
## Called immediately before `club` is mutated.
|
||||
func _on_club_change(new_club: T.Club) -> void:
|
||||
club_selector.value = new_club
|
||||
match new_club:
|
||||
T.Club.DRIVER:
|
||||
shot_ref = drive_ref
|
||||
drive_arrow.show()
|
||||
putt_arrow.hide()
|
||||
T.Club.PUTTER:
|
||||
shot_ref = putt_ref
|
||||
putt_arrow.show()
|
||||
drive_arrow.hide()
|
||||
|
||||
|
||||
## Called immediately before `phase` is mutated.
|
||||
func _on_phase_change(new_phase: Phase) -> void:
|
||||
match new_phase:
|
||||
Phase.AIM:
|
||||
|
@ -262,6 +295,18 @@ func _process(delta: float) -> void:
|
|||
if Input.is_action_just_pressed("shot_zoom_out"):
|
||||
camera_distance = min(camera_distance + 1.0, ZOOM_MAX)
|
||||
|
||||
# Club select
|
||||
if Input.is_action_just_pressed("select_driver"):
|
||||
club = T.Club.DRIVER
|
||||
if Input.is_action_just_pressed("select_iron"):
|
||||
club = T.Club.IRON
|
||||
if Input.is_action_just_pressed("select_wedge"):
|
||||
club = T.Club.WEDGE
|
||||
if Input.is_action_just_pressed("select_gold"):
|
||||
club = T.Club.GOLD
|
||||
if Input.is_action_just_pressed("select_putter"):
|
||||
club = T.Club.PUTTER
|
||||
|
||||
# Switch to free cam
|
||||
if (
|
||||
Input.is_action_just_pressed("camera_back")
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
[gd_scene load_steps=21 format=3 uid="uid://cy7t2tc4y3b4"]
|
||||
[gd_scene load_steps=22 format=3 uid="uid://cy7t2tc4y3b4"]
|
||||
|
||||
[ext_resource type="Script" path="res://src/player/shot_setup/shot_setup.gd" id="1_r6ei4"]
|
||||
[ext_resource type="PackedScene" uid="uid://dfttci386ohip" path="res://src/player/physics_ball/physics_ball.tscn" id="2_1i5j5"]
|
||||
[ext_resource type="PackedScene" uid="uid://c2k88ns0h5ie1" path="res://src/ui/arrow.tscn" id="2_s70wl"]
|
||||
[ext_resource type="PackedScene" uid="uid://445qd7m4qe2j" path="res://src/player/shot_setup/club_selector/club_selector.tscn" id="4_56ape"]
|
||||
|
||||
[sub_resource type="CapsuleMesh" id="CapsuleMesh_5uovl"]
|
||||
|
||||
|
@ -222,6 +223,17 @@ tracks/3/keys = {
|
|||
"points": PackedFloat32Array(0.5, -0.25, 0, 0.25, 0),
|
||||
"times": PackedFloat32Array(0)
|
||||
}
|
||||
tracks/4/type = "bezier"
|
||||
tracks/4/imported = false
|
||||
tracks/4/enabled = true
|
||||
tracks/4/path = NodePath(".:anchor_bottom")
|
||||
tracks/4/interp = 1
|
||||
tracks/4/loop_wrap = true
|
||||
tracks/4/keys = {
|
||||
"handle_modes": PackedInt32Array(0),
|
||||
"points": PackedFloat32Array(0.5, -0.25, 0, 0.25, 0),
|
||||
"times": PackedFloat32Array(0)
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_cwotn"]
|
||||
resource_name = "display"
|
||||
|
@ -274,6 +286,17 @@ tracks/3/keys = {
|
|||
"points": PackedFloat32Array(0.5, -0.25, 0, 0.5, -0.0548477, 0.5, -0.4, 0.0593877, 0.233401, -0.456136, 1.25, -0.25, 0, 0.25, 0),
|
||||
"times": PackedFloat32Array(0, 2, 2.4)
|
||||
}
|
||||
tracks/4/type = "bezier"
|
||||
tracks/4/imported = false
|
||||
tracks/4/enabled = true
|
||||
tracks/4/path = NodePath(".:anchor_bottom")
|
||||
tracks/4/interp = 1
|
||||
tracks/4/loop_wrap = true
|
||||
tracks/4/keys = {
|
||||
"handle_modes": PackedInt32Array(0, 0, 0),
|
||||
"points": PackedFloat32Array(0.5, -0.25, 0, 0.5, -0.055, 0.5, -0.4, 0.059, 0.233, -0.456, 1.25, -0.25, 0, 0.25, 0),
|
||||
"times": PackedFloat32Array(0, 2, 2.4)
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_2a0gn"]
|
||||
_data = {
|
||||
|
@ -384,6 +407,15 @@ collision_mask = 0
|
|||
collide_with_bodies = false
|
||||
debug_shape_thickness = 4
|
||||
|
||||
[node name="PuttRef" type="RayCast3D" parent="Direction"]
|
||||
unique_name_in_owner = true
|
||||
transform = Transform3D(-1, 0, 8.74228e-08, 0, 1, 0, -8.74228e-08, 0, -1, 0, 0.2, 0)
|
||||
enabled = false
|
||||
target_position = Vector3(0, 0, 1)
|
||||
collision_mask = 0
|
||||
collide_with_bodies = false
|
||||
debug_shape_thickness = 4
|
||||
|
||||
[node name="Elevation" type="Node3D" parent="Direction"]
|
||||
unique_name_in_owner = true
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.9, 0)
|
||||
|
@ -403,11 +435,7 @@ current = true
|
|||
|
||||
[node name="Arrow" type="Node3D" parent="."]
|
||||
unique_name_in_owner = true
|
||||
transform = Transform3D(0.001, 0, 0, 0, 0.000707107, 0.000707107, 0, -0.000707107, 0.000707107, 0, 0.1, 0)
|
||||
|
||||
[node name="ArrowMesh" parent="Arrow" instance=ExtResource("2_s70wl")]
|
||||
transform = Transform3D(0.2, 0, 0, 0, 0.4, 0, 0, 0, 0.2, 0, 1, 0)
|
||||
loop_animation = 1
|
||||
transform = Transform3D(0.001, 0, 0, 0, 0.001, 0, 0, 0, 0.001, 0, 0.1, 0)
|
||||
|
||||
[node name="ArrowAnimation" type="AnimationPlayer" parent="Arrow"]
|
||||
unique_name_in_owner = true
|
||||
|
@ -416,6 +444,24 @@ libraries = {
|
|||
}
|
||||
autoplay = "show"
|
||||
|
||||
[node name="DriveArrow" type="Node3D" parent="Arrow"]
|
||||
unique_name_in_owner = true
|
||||
transform = Transform3D(1, 0, 0, 0, 0.707107, 0.707107, 0, -0.707107, 0.707107, 0, 0, 0)
|
||||
visible = false
|
||||
|
||||
[node name="ArrowMesh" parent="Arrow/DriveArrow" instance=ExtResource("2_s70wl")]
|
||||
transform = Transform3D(0.2, 0, 0, 0, 0.4, 0, 0, 0, 0.2, 0, 1, 0)
|
||||
loop_animation = 1
|
||||
|
||||
[node name="PuttArrow" type="Node3D" parent="Arrow"]
|
||||
unique_name_in_owner = true
|
||||
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0, 0, 0)
|
||||
visible = false
|
||||
|
||||
[node name="ArrowMesh" parent="Arrow/PuttArrow" instance=ExtResource("2_s70wl")]
|
||||
transform = Transform3D(0.2, 0, 0, 0, 0.4, 0, 0, 0, 0.2, 0, 1, 0)
|
||||
loop_animation = 1
|
||||
|
||||
[node name="ShotAnimation" type="AnimationPlayer" parent="."]
|
||||
unique_name_in_owner = true
|
||||
root_node = NodePath("../Direction/Elevation/Pitch/Zoom/Camera")
|
||||
|
@ -424,6 +470,7 @@ libraries = {
|
|||
}
|
||||
|
||||
[node name="ShotUI" type="Control" parent="."]
|
||||
top_level = true
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
|
@ -440,11 +487,11 @@ anchors_preset = -1
|
|||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 1.25
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -350.0
|
||||
offset_top = -195.6
|
||||
offset_top = -66.0
|
||||
offset_right = 350.0
|
||||
offset_bottom = -63.6
|
||||
offset_bottom = 66.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
mouse_filter = 2
|
||||
|
@ -470,10 +517,6 @@ anchor_left = 0.4
|
|||
anchor_top = 0.3
|
||||
anchor_right = 0.6
|
||||
anchor_bottom = 0.85
|
||||
offset_left = -20.0
|
||||
offset_top = -20.0
|
||||
offset_right = 20.0
|
||||
offset_bottom = 20.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
mouse_filter = 1
|
||||
|
@ -544,4 +587,17 @@ libraries = {
|
|||
[node name="GaugeFlasher" type="AnimationPlayer" parent="ShotUI/ShotGauges"]
|
||||
unique_name_in_owner = true
|
||||
|
||||
[node name="ClubSelector" parent="ShotUI" instance=ExtResource("4_56ape")]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 1
|
||||
anchors_preset = 0
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
offset_left = 50.0
|
||||
offset_top = 50.0
|
||||
offset_right = 50.0
|
||||
offset_bottom = 50.0
|
||||
grow_horizontal = 1
|
||||
grow_vertical = 1
|
||||
|
||||
[connection signal="sleeping_state_changed" from="BallPoint/PhysicsBall" to="." method="_on_physics_ball_sleeping_state_changed"]
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
@tool
|
||||
class_name Arc extends Control
|
||||
|
||||
const BASE_POINTS := 64
|
||||
|
||||
@export var gap_angle := 0.1
|
||||
@export var width := 1.0
|
||||
@export var antialiased := true
|
||||
@export var color: Color
|
||||
|
||||
|
||||
func _draw() -> void:
|
||||
var radius: float = minf(size.x, size.y) / 2.0
|
||||
var point_count: int = int(BASE_POINTS * (TAU - gap_angle) / TAU)
|
||||
draw_arc(
|
||||
Vector2(radius, radius), radius, gap_angle, TAU, point_count, color, width, antialiased
|
||||
)
|
|
@ -0,0 +1,17 @@
|
|||
@tool
|
||||
extends Control
|
||||
## UI element that automatically rotates its children to invert the rotation of the element itself.
|
||||
|
||||
@onready var _last_rotation: float = rotation
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
draw.connect(_on_draw)
|
||||
|
||||
|
||||
func _on_draw() -> void:
|
||||
var d_rotation := rotation - _last_rotation
|
||||
for c: Node in get_children():
|
||||
if c is Control:
|
||||
(c as Control).rotation -= d_rotation
|
||||
_last_rotation = rotation
|
|
@ -1,4 +1,10 @@
|
|||
[gd_resource type="Theme" load_steps=2 format=3 uid="uid://diodjft5u2cck"]
|
||||
[gd_resource type="Theme" load_steps=3 format=3 uid="uid://diodjft5u2cck"]
|
||||
|
||||
[sub_resource type="SystemFont" id="SystemFont_dpm3o"]
|
||||
font_names = PackedStringArray("Sans-Serif")
|
||||
font_italic = true
|
||||
font_weight = 800
|
||||
generate_mipmaps = true
|
||||
|
||||
[sub_resource type="SystemFont" id="SystemFont_2dr7l"]
|
||||
font_names = PackedStringArray("Sans-Serif")
|
||||
|
@ -6,6 +12,12 @@ font_italic = true
|
|||
font_weight = 800
|
||||
|
||||
[resource]
|
||||
ClubSelectLabel/base_type = &"Label"
|
||||
ClubSelectLabel/colors/font_color = Color(1, 0.933333, 0.894118, 1)
|
||||
ClubSelectLabel/colors/font_outline_color = Color(0, 0, 0, 1)
|
||||
ClubSelectLabel/constants/outline_size = 2
|
||||
ClubSelectLabel/font_sizes/font_size = 28
|
||||
ClubSelectLabel/fonts/font = SubResource("SystemFont_dpm3o")
|
||||
ShotFeedback/base_type = &"Label"
|
||||
ShotFeedback/colors/font_color = Color(0.807843, 1, 1, 1)
|
||||
ShotFeedback/colors/font_shadow_color = Color(0, 0, 0, 1)
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
class_name T extends Object
|
||||
## Library for shared game enum types
|
||||
|
||||
enum Club {
|
||||
DRIVER,
|
||||
IRON,
|
||||
GOLD,
|
||||
WEDGE,
|
||||
PUTTER,
|
||||
}
|
Loading…
Reference in New Issue