From 2190d18d8d58f867927126829e7c0d7ef6fac372 Mon Sep 17 00:00:00 2001 From: bd Date: Sat, 24 May 2025 18:50:01 -0400 Subject: Add UI panel which displays actions/upgrades --- scenes/Main.tscn | 2 +- scenes/ui.tscn | 41 +++++++++++++---------------------------- scenes/ui_option.tscn | 34 ++++++++++++++++++++++++++++++++++ scenes/ui_panel.tscn | 34 ---------------------------------- 4 files changed, 48 insertions(+), 63 deletions(-) create mode 100644 scenes/ui_option.tscn delete mode 100644 scenes/ui_panel.tscn (limited to 'scenes') diff --git a/scenes/Main.tscn b/scenes/Main.tscn index cf7c8c7..524c766 100644 --- a/scenes/Main.tscn +++ b/scenes/Main.tscn @@ -27,7 +27,7 @@ func free_tile(tile_position): [node name="Main" type="Node2D"] -[node name="Cursor" parent="." instance=ExtResource("4_rarhs")] +[node name="Player" parent="." instance=ExtResource("4_rarhs")] z_index = 2 [node name="Map" parent="." instance=ExtResource("2_vcsgt")] diff --git a/scenes/ui.tscn b/scenes/ui.tscn index c7d05a9..5f10b53 100644 --- a/scenes/ui.tscn +++ b/scenes/ui.tscn @@ -1,19 +1,19 @@ -[gd_scene load_steps=5 format=3 uid="uid://dycgp3yept14k"] +[gd_scene load_steps=3 format=3 uid="uid://dycgp3yept14k"] -[ext_resource type="Script" uid="uid://dtj2opmwvh4y1" path="res://scripts/life.gd" id="1_suays"] -[ext_resource type="Script" uid="uid://b8urrbmynk327" path="res://scripts/morale.gd" id="1_yb1mt"] -[ext_resource type="PackedScene" uid="uid://edgs77gubcl8" path="res://scenes/ui_panel.tscn" id="3_yev5y"] +[ext_resource type="Script" uid="uid://biw5cwtetstux" path="res://scripts/ui.gd" id="1_yev5y"] [sub_resource type="StyleBoxFlat" id="StyleBoxFlat_nt14h"] bg_color = Color(0, 0.0117647, 0.552941, 1) -[node name="PanelContainer" type="PanelContainer"] +[node name="UI" type="PanelContainer"] anchors_preset = 10 anchor_right = 1.0 +offset_right = -313.0 offset_bottom = 17.0 grow_horizontal = 2 -size_flags_vertical = 0 +size_flags_horizontal = 3 theme_override_styles/panel = SubResource("StyleBoxFlat_nt14h") +script = ExtResource("1_yev5y") [node name="MarginContainer" type="MarginContainer" parent="."] layout_mode = 2 @@ -22,39 +22,24 @@ theme_override_constants/margin_top = 0 [node name="HBoxContainer" type="HBoxContainer" parent="MarginContainer"] layout_mode = 2 +size_flags_vertical = 0 [node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/HBoxContainer"] +clip_contents = true layout_mode = 2 +size_flags_horizontal = 0 theme_override_constants/separation = -3 [node name="Morale" type="Label" parent="MarginContainer/HBoxContainer/VBoxContainer"] layout_mode = 2 theme_override_font_sizes/font_size = 8 -text = "Morale: 10" -script = ExtResource("1_yb1mt") +text = " Morale: " [node name="Life" type="Label" parent="MarginContainer/HBoxContainer/VBoxContainer"] layout_mode = 2 theme_override_font_sizes/font_size = 8 -text = "Life: 20" -script = ExtResource("1_suays") - -[node name="Warlock" parent="MarginContainer/HBoxContainer" instance=ExtResource("3_yev5y")] -layout_mode = 2 -object_name = "warlock" -cost = "10" - -[node name="Wyvern" parent="MarginContainer/HBoxContainer" instance=ExtResource("3_yev5y")] -layout_mode = 2 -object_name = "wyvern" -cost = "15" - -[node name="Werewolf" parent="MarginContainer/HBoxContainer" instance=ExtResource("3_yev5y")] -layout_mode = 2 -object_name = "werewolf" -cost = "-" +text = "Life: " -[node name="Wellspring" parent="MarginContainer/HBoxContainer" instance=ExtResource("3_yev5y")] +[node name="HBoxContainer" type="HBoxContainer" parent="MarginContainer/HBoxContainer"] layout_mode = 2 -object_name = "wellspring" -cost = "-" +size_flags_horizontal = 3 diff --git a/scenes/ui_option.tscn b/scenes/ui_option.tscn new file mode 100644 index 0000000..d89e8cd --- /dev/null +++ b/scenes/ui_option.tscn @@ -0,0 +1,34 @@ +[gd_scene load_steps=3 format=3 uid="uid://edgs77gubcl8"] + +[ext_resource type="Script" uid="uid://do8a8uq1jvs7b" path="res://scripts/ui_panel.gd" id="1_c3u8h"] + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_sv14y"] +bg_color = Color(0, 0.00526825, 0.379014, 1) + +[node name="UIOption" type="Panel"] +custom_minimum_size = Vector2(16, 16) +offset_right = 24.0 +offset_bottom = 16.0 +size_flags_horizontal = 3 +theme_override_styles/panel = SubResource("StyleBoxFlat_sv14y") +script = ExtResource("1_c3u8h") + +[node name="HBoxContainer" type="HBoxContainer" parent="."] +layout_mode = 0 +offset_right = 16.0 +offset_bottom = 17.0 + +[node name="Texture" type="TextureRect" parent="HBoxContainer"] +layout_mode = 2 + +[node name="VBoxContainer" type="VBoxContainer" parent="HBoxContainer"] +layout_mode = 2 +theme_override_constants/separation = -3 + +[node name="Label" type="Label" parent="HBoxContainer/VBoxContainer"] +layout_mode = 2 +theme_override_font_sizes/font_size = 8 + +[node name="Label2" type="Label" parent="HBoxContainer/VBoxContainer"] +layout_mode = 2 +theme_override_font_sizes/font_size = 8 diff --git a/scenes/ui_panel.tscn b/scenes/ui_panel.tscn deleted file mode 100644 index e761516..0000000 --- a/scenes/ui_panel.tscn +++ /dev/null @@ -1,34 +0,0 @@ -[gd_scene load_steps=3 format=3 uid="uid://edgs77gubcl8"] - -[ext_resource type="Script" uid="uid://do8a8uq1jvs7b" path="res://scripts/ui_panel.gd" id="1_d2vu8"] - -[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_sv14y"] -bg_color = Color(0, 0.00526825, 0.379014, 1) - -[node name="UIPanel" type="Panel"] -custom_minimum_size = Vector2(16, 16) -offset_right = 24.0 -offset_bottom = 16.0 -size_flags_horizontal = 3 -theme_override_styles/panel = SubResource("StyleBoxFlat_sv14y") -script = ExtResource("1_d2vu8") - -[node name="HBoxContainer" type="HBoxContainer" parent="."] -layout_mode = 0 -offset_right = 16.0 -offset_bottom = 17.0 - -[node name="Texture" type="TextureRect" parent="HBoxContainer"] -layout_mode = 2 - -[node name="VBoxContainer" type="VBoxContainer" parent="HBoxContainer"] -layout_mode = 2 -theme_override_constants/separation = -3 - -[node name="Label" type="Label" parent="HBoxContainer/VBoxContainer"] -layout_mode = 2 -theme_override_font_sizes/font_size = 8 - -[node name="Label2" type="Label" parent="HBoxContainer/VBoxContainer"] -layout_mode = 2 -theme_override_font_sizes/font_size = 8 -- cgit v1.2.3