From d129a410b82db58deaabaf81c3954ff2f239a142 Mon Sep 17 00:00:00 2001 From: Rob Kelly Date: Thu, 21 Nov 2024 00:21:11 -0700 Subject: [PATCH] UI scaling & bugfixes --- src/player/shot_setup/shot_setup.gd | 6 +- .../shot_hud/ball_selector/ball_selector.tscn | 14 +-- src/ui/shot_hud/shot_hud.tscn | 97 ++++++++++--------- 3 files changed, 53 insertions(+), 64 deletions(-) diff --git a/src/player/shot_setup/shot_setup.gd b/src/player/shot_setup/shot_setup.gd index e4a4082..daf9fa4 100644 --- a/src/player/shot_setup/shot_setup.gd +++ b/src/player/shot_setup/shot_setup.gd @@ -235,6 +235,7 @@ func take_shot() -> void: print_debug("Shot impulse: ", impulse, "; ", impulse.length(), " N*s") if game_ball: + game_ball.iron_ball = club == Club.Type.IRON game_ball.freeze = false game_ball.apply_central_impulse(impulse) @@ -354,8 +355,6 @@ func _on_club_change(new_club_type: Club.Type) -> void: wedge_arrow.hide() iron_arrow.hide() putt_arrow.hide() - if game_ball: - game_ball.iron_ball = false hud.club_selector.value = new_club_type # TODO club change animation character.hold_right(new_club.get_model()) @@ -372,8 +371,6 @@ func _on_club_change(new_club_type: Club.Type) -> void: Club.Type.IRON: shot_ref = iron_ref iron_arrow.show() - if game_ball: - game_ball.iron_ball = true Club.Type.SPECIAL: # TODO figure this out shot_ref = drive_ref @@ -426,7 +423,6 @@ func _on_phase_change(new_phase: Phase) -> void: func _on_game_ball_changed(ball: GameBall) -> void: if ball: - ball.iron_ball = (club == Club.Type.IRON) ball.entered_water.connect(_on_ball_entered_water) ball.sleeping_state_changed.connect(_on_ball_sleeping_state_changed) diff --git a/src/ui/shot_hud/ball_selector/ball_selector.tscn b/src/ui/shot_hud/ball_selector/ball_selector.tscn index f961201..8cd0ed7 100644 --- a/src/ui/shot_hud/ball_selector/ball_selector.tscn +++ b/src/ui/shot_hud/ball_selector/ball_selector.tscn @@ -43,18 +43,10 @@ texture = SubResource("GradientTexture2D_tm61r") [node name="BallList" type="VBoxContainer" parent="GradientMask"] unique_name_in_owner = true custom_minimum_size = Vector2(120, 0) -layout_mode = 1 -anchors_preset = 8 -anchor_left = 0.5 -anchor_top = 0.5 -anchor_right = 0.5 -anchor_bottom = 0.5 -offset_left = -120.0 -offset_top = 18.0 +layout_mode = 0 +offset_top = 50.0 offset_right = 120.0 -offset_bottom = 146.0 -grow_horizontal = 2 -grow_vertical = 2 +offset_bottom = 109.0 theme_override_constants/separation = 5 [node name="BasicIcon" parent="GradientMask/BallList" instance=ExtResource("1_1v8xg")] diff --git a/src/ui/shot_hud/shot_hud.tscn b/src/ui/shot_hud/shot_hud.tscn index c0359af..e8490e6 100644 --- a/src/ui/shot_hud/shot_hud.tscn +++ b/src/ui/shot_hud/shot_hud.tscn @@ -441,26 +441,26 @@ length = 0.001 tracks/0/type = "value" tracks/0/imported = false tracks/0/enabled = true -tracks/0/path = NodePath("SouthWest:position") +tracks/0/path = NodePath("SouthWest:visible") tracks/0/interp = 1 tracks/0/loop_wrap = true tracks/0/keys = { "times": PackedFloat32Array(0), "transitions": PackedFloat32Array(1), -"update": 0, -"values": [Vector2(0, 982)] +"update": 1, +"values": [true] } tracks/1/type = "value" tracks/1/imported = false tracks/1/enabled = true -tracks/1/path = NodePath("SouthWest:visible") -tracks/1/interp = 1 +tracks/1/path = NodePath("SouthWest:offset_top") +tracks/1/interp = 2 tracks/1/loop_wrap = true tracks/1/keys = { "times": PackedFloat32Array(0), "transitions": PackedFloat32Array(1), -"update": 1, -"values": [true] +"update": 0, +"values": [-98.0] } [sub_resource type="Animation" id="Animation_yis4x"] @@ -470,27 +470,27 @@ step = 0.02 tracks/0/type = "value" tracks/0/imported = false tracks/0/enabled = true -tracks/0/path = NodePath("SouthWest:position") -tracks/0/interp = 2 +tracks/0/path = NodePath("SouthWest:visible") +tracks/0/interp = 1 tracks/0/loop_wrap = true tracks/0/keys = { -"times": PackedFloat32Array(0, 0.1, 0.4), -"transitions": PackedFloat32Array(1.618, 1.618, 1), -"update": 0, -"values": [Vector2(0, 982), Vector2(0, 960), Vector2(0, 1100)] -} -tracks/1/type = "value" -tracks/1/imported = false -tracks/1/enabled = true -tracks/1/path = NodePath("SouthWest:visible") -tracks/1/interp = 1 -tracks/1/loop_wrap = true -tracks/1/keys = { "times": PackedFloat32Array(0.4), "transitions": PackedFloat32Array(1), "update": 1, "values": [false] } +tracks/1/type = "value" +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/path = NodePath("SouthWest:offset_top") +tracks/1/interp = 2 +tracks/1/loop_wrap = true +tracks/1/keys = { +"times": PackedFloat32Array(0, 0.1, 0.4), +"transitions": PackedFloat32Array(1.618, 1.618, 1), +"update": 0, +"values": [-98.0, -120.0, 20.0] +} [sub_resource type="Animation" id="Animation_jugqx"] resource_name = "peek" @@ -499,27 +499,27 @@ step = 0.02 tracks/0/type = "value" tracks/0/imported = false tracks/0/enabled = true -tracks/0/path = NodePath("SouthWest:position") +tracks/0/path = NodePath("SouthWest:visible") tracks/0/interp = 1 tracks/0/loop_wrap = true tracks/0/keys = { -"times": PackedFloat32Array(0, 0.1, 2.3, 2.4), -"transitions": PackedFloat32Array(1.618, 1, 1.618, 1), -"update": 0, -"values": [Vector2(0, 1100), Vector2(0, 982), Vector2(0, 982), Vector2(0, 1100)] -} -tracks/1/type = "value" -tracks/1/imported = false -tracks/1/enabled = true -tracks/1/path = NodePath("SouthWest:visible") -tracks/1/interp = 1 -tracks/1/loop_wrap = true -tracks/1/keys = { "times": PackedFloat32Array(0, 2.4), "transitions": PackedFloat32Array(1, 1), "update": 1, "values": [true, false] } +tracks/1/type = "value" +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/path = NodePath("SouthWest:offset_top") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/keys = { +"times": PackedFloat32Array(0, 0.1, 2.3, 2.4), +"transitions": PackedFloat32Array(1.618, 1, 1.618, 1), +"update": 0, +"values": [20.0, -98.0, -98.0, 20.0] +} [sub_resource type="Animation" id="Animation_nicro"] resource_name = "show_life_bar" @@ -528,27 +528,27 @@ step = 0.02 tracks/0/type = "value" tracks/0/imported = false tracks/0/enabled = true -tracks/0/path = NodePath("SouthWest:position") -tracks/0/interp = 2 +tracks/0/path = NodePath("SouthWest:visible") +tracks/0/interp = 1 tracks/0/loop_wrap = true tracks/0/keys = { -"times": PackedFloat32Array(0, 0.34, 0.4), -"transitions": PackedFloat32Array(1.618, 1.618, 1), -"update": 0, -"values": [Vector2(0, 1100), Vector2(0, 960), Vector2(0, 982)] -} -tracks/1/type = "value" -tracks/1/imported = false -tracks/1/enabled = true -tracks/1/path = NodePath("SouthWest:visible") -tracks/1/interp = 1 -tracks/1/loop_wrap = true -tracks/1/keys = { "times": PackedFloat32Array(0), "transitions": PackedFloat32Array(1), "update": 1, "values": [true] } +tracks/1/type = "value" +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/path = NodePath("SouthWest:offset_top") +tracks/1/interp = 2 +tracks/1/loop_wrap = true +tracks/1/keys = { +"times": PackedFloat32Array(0, 0.34, 0.4), +"transitions": PackedFloat32Array(1.618, 1.618, 1), +"update": 0, +"values": [20.0, -120.0, -98.0] +} [sub_resource type="AnimationLibrary" id="AnimationLibrary_c3i4w"] _data = { @@ -782,6 +782,7 @@ anchor_right = 0.333 anchor_bottom = 1.0 offset_top = -98.0 offset_right = 40.0 +offset_bottom = 278.665 grow_vertical = 0 theme_override_constants/margin_left = 16 theme_override_constants/margin_bottom = 16