Item icons are now properly scaled.

main
Martin Felis 2024-07-12 11:59:33 +02:00
parent 71550b15fe
commit f9ced395ce
5 changed files with 86 additions and 83 deletions

153
Game.tscn
View File

@ -357,6 +357,80 @@ layout_mode = 2
text = "Start
"
[node name="GameMenuUI" type="PanelContainer" parent="RootUI"]
unique_name_in_owner = true
visible = false
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -199.0
offset_top = -186.0
offset_right = 199.0
offset_bottom = 186.0
grow_horizontal = 2
grow_vertical = 2
theme = ExtResource("8_qpuke")
[node name="MarginContainer" type="MarginContainer" parent="RootUI/GameMenuUI"]
layout_mode = 2
theme_override_constants/margin_left = 60
theme_override_constants/margin_top = 60
theme_override_constants/margin_right = 60
theme_override_constants/margin_bottom = 60
[node name="VBoxContainer" type="VBoxContainer" parent="RootUI/GameMenuUI/MarginContainer"]
layout_mode = 2
[node name="MarginContainer4" type="MarginContainer" parent="RootUI/GameMenuUI/MarginContainer/VBoxContainer"]
layout_mode = 2
theme_override_constants/margin_left = 8
theme_override_constants/margin_top = 8
theme_override_constants/margin_right = 8
theme_override_constants/margin_bottom = 8
[node name="SaveGameButton" type="Button" parent="RootUI/GameMenuUI/MarginContainer/VBoxContainer/MarginContainer4"]
layout_mode = 2
text = "Save Game
"
[node name="MarginContainer2" type="MarginContainer" parent="RootUI/GameMenuUI/MarginContainer/VBoxContainer"]
layout_mode = 2
theme_override_constants/margin_left = 8
theme_override_constants/margin_top = 8
theme_override_constants/margin_right = 8
theme_override_constants/margin_bottom = 8
[node name="OptionsButton" type="Button" parent="RootUI/GameMenuUI/MarginContainer/VBoxContainer/MarginContainer2"]
layout_mode = 2
text = "Options"
[node name="MarginContainer3" type="MarginContainer" parent="RootUI/GameMenuUI/MarginContainer/VBoxContainer"]
layout_mode = 2
theme_override_constants/margin_left = 8
theme_override_constants/margin_top = 8
theme_override_constants/margin_right = 8
theme_override_constants/margin_bottom = 8
[node name="BackToGameButton" type="Button" parent="RootUI/GameMenuUI/MarginContainer/VBoxContainer/MarginContainer3"]
layout_mode = 2
text = "Return to Game"
[node name="HSeparator" type="HSeparator" parent="RootUI/GameMenuUI/MarginContainer/VBoxContainer"]
layout_mode = 2
[node name="MarginContainer5" type="MarginContainer" parent="RootUI/GameMenuUI/MarginContainer/VBoxContainer"]
layout_mode = 2
theme_override_constants/margin_left = 8
theme_override_constants/margin_top = 8
theme_override_constants/margin_right = 8
theme_override_constants/margin_bottom = 8
[node name="ToMainMenuButton" type="Button" parent="RootUI/GameMenuUI/MarginContainer/VBoxContainer/MarginContainer5"]
layout_mode = 2
text = "Back to Main Menu"
[node name="GameUI" type="Control" parent="RootUI"]
unique_name_in_owner = true
layout_mode = 3
@ -592,79 +666,8 @@ text = "Backpack"
[node name="InventoryContainer" parent="RootUI/GameUI/InventoryDialog/Panel/PanelContainer/BackpackUI/VBoxContainer" instance=ExtResource("15_5xu2a")]
unique_name_in_owner = true
layout_mode = 2
[node name="GameMenuUI" type="PanelContainer" parent="RootUI"]
unique_name_in_owner = true
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -199.0
offset_top = -134.5
offset_right = 199.0
offset_bottom = 134.5
grow_horizontal = 2
grow_vertical = 2
theme = ExtResource("8_qpuke")
[node name="MarginContainer" type="MarginContainer" parent="RootUI/GameMenuUI"]
layout_mode = 2
theme_override_constants/margin_left = 60
theme_override_constants/margin_top = 60
theme_override_constants/margin_right = 60
theme_override_constants/margin_bottom = 60
[node name="VBoxContainer" type="VBoxContainer" parent="RootUI/GameMenuUI/MarginContainer"]
layout_mode = 2
[node name="MarginContainer4" type="MarginContainer" parent="RootUI/GameMenuUI/MarginContainer/VBoxContainer"]
layout_mode = 2
theme_override_constants/margin_left = 8
theme_override_constants/margin_top = 8
theme_override_constants/margin_right = 8
theme_override_constants/margin_bottom = 8
[node name="SaveGameButton" type="Button" parent="RootUI/GameMenuUI/MarginContainer/VBoxContainer/MarginContainer4"]
layout_mode = 2
text = "Save Game
"
[node name="MarginContainer2" type="MarginContainer" parent="RootUI/GameMenuUI/MarginContainer/VBoxContainer"]
layout_mode = 2
theme_override_constants/margin_left = 8
theme_override_constants/margin_top = 8
theme_override_constants/margin_right = 8
theme_override_constants/margin_bottom = 8
[node name="OptionsButton" type="Button" parent="RootUI/GameMenuUI/MarginContainer/VBoxContainer/MarginContainer2"]
layout_mode = 2
text = "Options"
[node name="MarginContainer3" type="MarginContainer" parent="RootUI/GameMenuUI/MarginContainer/VBoxContainer"]
layout_mode = 2
theme_override_constants/margin_left = 8
theme_override_constants/margin_top = 8
theme_override_constants/margin_right = 8
theme_override_constants/margin_bottom = 8
[node name="BackToGameButton" type="Button" parent="RootUI/GameMenuUI/MarginContainer/VBoxContainer/MarginContainer3"]
layout_mode = 2
text = "Return to Game"
[node name="HSeparator" type="HSeparator" parent="RootUI/GameMenuUI/MarginContainer/VBoxContainer"]
layout_mode = 2
[node name="MarginContainer5" type="MarginContainer" parent="RootUI/GameMenuUI/MarginContainer/VBoxContainer"]
layout_mode = 2
theme_override_constants/margin_left = 8
theme_override_constants/margin_top = 8
theme_override_constants/margin_right = 8
theme_override_constants/margin_bottom = 8
[node name="ToMainMenuButton" type="Button" parent="RootUI/GameMenuUI/MarginContainer/VBoxContainer/MarginContainer5"]
layout_mode = 2
text = "Back to Main Menu"
size_flags_horizontal = 4
size_flags_vertical = 4
[node name="tree-pine2" parent="." instance=ExtResource("21_5210s")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.754677, 0, 0.0391712)
@ -686,9 +689,9 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2.851, 0, 0.798104)
[connection signal="pressed" from="RootUI/MainMenuUI/MarginContainer/VBoxContainer/MarginContainer3/QuitButton" to="RootUI" method="_on_quit_button_pressed"]
[connection signal="pressed" from="RootUI/NewGameUI/MarginContainer/VBoxContainer/MarginContainer3/HBoxContainer/BackButton" to="RootUI" method="_to_main_menu_button_pressed"]
[connection signal="pressed" from="RootUI/NewGameUI/MarginContainer/VBoxContainer/MarginContainer3/HBoxContainer/StartGameButton" to="RootUI" method="_on_start_game_button_pressed"]
[connection signal="pressed" from="RootUI/GameMenuUI/MarginContainer/VBoxContainer/MarginContainer3/BackToGameButton" to="RootUI" method="_on_start_game_button_pressed"]
[connection signal="pressed" from="RootUI/GameMenuUI/MarginContainer/VBoxContainer/MarginContainer5/ToMainMenuButton" to="RootUI" method="_to_main_menu_button_pressed"]
[connection signal="timeout" from="RootUI/GameUI/MessagesContainer/MessageTimer" to="RootUI/GameUI" method="_on_message_timer_timeout"]
[connection signal="pressed" from="RootUI/GameUI/InventoryDialog/Panel/PanelContainer/Title/CloseButton" to="RootUI/GameUI/InventoryDialog" method="_on_close_button_pressed"]
[connection signal="item_selected" from="RootUI/GameUI/InventoryDialog/Panel/PanelContainer/CraftingUI/HBoxContainer/Recipes/RecipeList" to="RootUI/GameUI/InventoryDialog" method="_on_recipe_list_item_selected"]
[connection signal="pressed" from="RootUI/GameUI/InventoryDialog/Panel/PanelContainer/CraftingUI/HBoxContainer/CraftResult/HBoxContainer/CraftButton" to="RootUI/GameUI/InventoryDialog" method="_on_craft_button_pressed"]
[connection signal="pressed" from="RootUI/GameMenuUI/MarginContainer/VBoxContainer/MarginContainer3/BackToGameButton" to="RootUI" method="_on_start_game_button_pressed"]
[connection signal="pressed" from="RootUI/GameMenuUI/MarginContainer/VBoxContainer/MarginContainer5/ToMainMenuButton" to="RootUI" method="_to_main_menu_button_pressed"]

View File

@ -1,11 +1,6 @@
extends Control
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
func _on_message_timer_timeout():
%MessagesContainer.visible = false

View File

@ -32,10 +32,12 @@ func _physics_process(delta):
move_and_slide()
if velocity.length_squared() > 0.1 * 0.1:
last_nonzero_velocity = velocity.normalized()
var ground_velocity:Vector2 = Vector2(velocity.x, velocity.z)
if ground_velocity.length_squared() > 0.1 * 0.1:
last_nonzero_velocity = Vector3(ground_velocity.x, 0, ground_velocity.y).normalized()
geometry.look_at(position - last_nonzero_velocity)
geometry.look_at(position - last_nonzero_velocity, Vector3.UP)
func on_item_picked_up(item:Item):
inventory.add_item(item)

View File

@ -17,6 +17,7 @@ func _ready():
_all_recipes.append(recipe)
activate_ui_panel(%GameUI)
# activate_ui_panel(%MainMenuUI)
func activate_ui_panel(ui_panel:Control):

View File

@ -4,9 +4,11 @@
[ext_resource type="Texture2D" uid="uid://ojsbkfjeu088" path="res://assets/kenney/survival-kit/Previews/toolPickaxe.png" id="1_mafu0"]
[node name="PanelContainer" type="PanelContainer"]
custom_minimum_size = Vector2(64, 64)
script = ExtResource("1_7v5l8")
[node name="TextureRect" type="TextureRect" parent="."]
unique_name_in_owner = true
layout_mode = 2
texture = ExtResource("1_mafu0")
expand_mode = 3