Compare commits

...

2 Commits

Author SHA1 Message Date
Martin Felis 4612e79e1f Refactored for cleaner game/menu switches. 2024-08-15 22:15:24 +02:00
Martin Felis ead02217a5 Minor refactoring. 2024-08-15 21:29:01 +02:00
10 changed files with 635 additions and 615 deletions

View File

@ -3,6 +3,7 @@ extends Control
@onready var tool_slots = %ToolSlots
@onready var game_menu_ui = %GameMenuUI
var game_scene:Node3D
func _on_message_timer_timeout():
%MessagesContainer.visible = false
@ -28,13 +29,17 @@ func _unhandled_key_input(event:InputEvent):
func _on_game_menu_ui_visibility_changed():
# Function gets triggered when scene is still in construction. In that
# case just return.
if tool_slots == null:
if tool_slots == null or game_scene == null:
return
if %GameMenuUI.visible:
tool_slots.hide()
%GameScene.process_mode = Node.PROCESS_MODE_DISABLED
game_scene.process_mode = Node.PROCESS_MODE_DISABLED
else:
tool_slots.show()
%GameScene.process_mode = Node.PROCESS_MODE_INHERIT
game_scene.process_mode = Node.PROCESS_MODE_INHERIT
func _on_back_to_game_button_pressed():
%GameMenuUI.hide()

View File

@ -11,7 +11,7 @@ config_version=5
[application]
config/name="TinyBuildAdventure"
run/main_scene="res://scenes/game.tscn"
run/main_scene="res://scenes/main.tscn"
config/features=PackedStringArray("4.2", "Forward Plus")
config/icon="res://icon.svg"

View File

@ -1,15 +1,19 @@
class_name RootUI
extends CanvasLayer
@export var startup_scene:PackedScene
@export var game_scene:PackedScene
@onready var ui_panels:Array = [ %MainMenuUI, %NewGameUI, %GameUI, %GameMenuUI ]
@onready var active_ui_panel:Control = null
@onready var player = %Player
@onready var inventory_dialog:InventoryDialog = %InventoryDialog
@onready var scene = %Scene
enum ROOT_UI_STATE { MENU, GAME }
var _root_ui_state:ROOT_UI_STATE = ROOT_UI_STATE.GAME
enum ROOT_UI_STATE { UNDEFINED, MENU, GAME }
var _root_ui_state:ROOT_UI_STATE = ROOT_UI_STATE.UNDEFINED
var _all_recipes:Array[Recipe] = []
var _player:Player = null
# Called when the node enters the scene tree for the first time.
func _ready():
@ -18,8 +22,6 @@ func _ready():
var recipe:Recipe = load(resource_file) as Recipe
_all_recipes.append(recipe)
player.connect("trigger_message", ui_panels[2]._on_player_trigger_message)
set_root_ui_state(ROOT_UI_STATE.GAME)
func activate_ui_panel(ui_panel:Control):
@ -31,17 +33,40 @@ func activate_ui_panel(ui_panel:Control):
active_ui_panel = ui_panel
func disconnect_player_signals():
_player.disconnect("trigger_message", %GameUI._on_player_trigger_message)
func update_player_signals():
_player.connect("trigger_message", %GameUI._on_player_trigger_message)
func load_scene(scene_resource:PackedScene):
if _player:
disconnect_player_signals()
for child in scene.get_children():
child.queue_free()
child.get_parent().remove_child(child)
scene.add_child(scene_resource.instantiate())
_player = scene.find_child("Player", true, false)
if _player:
update_player_signals()
func set_root_ui_state(state:ROOT_UI_STATE):
if _root_ui_state == state:
return
if state == ROOT_UI_STATE.GAME:
%GameScene.show()
%StartupScene.hide()
%GameScene.process_mode = Node.PROCESS_MODE_INHERIT
load_scene(game_scene)
%GameUI.game_scene = scene.get_child(0)
activate_ui_panel(%GameUI)
else:
%StartupScene.show()
%GameScene.hide()
load_scene(startup_scene)
%GameUI.game_scene = null
%GameMenuUI.hide()
%GameScene.process_mode = Node.PROCESS_MODE_DISABLED
activate_ui_panel(%MainMenuUI)
_root_ui_state = state
@ -64,4 +89,4 @@ func _to_main_menu_button_pressed():
func _unhandled_input(event):
if event.is_action_released("toggle_inventory"):
inventory_dialog.open(_all_recipes, player.inventory)
inventory_dialog.open(_all_recipes, _player.inventory)

View File

@ -1,41 +1,23 @@
[gd_scene load_steps=37 format=3 uid="uid://bugqatylloxkl"]
[gd_scene load_steps=19 format=3 uid="uid://cqie4cy0uy1t0"]
[ext_resource type="Script" path="res://scenes/game.gd" id="1_uwyoo"]
[ext_resource type="Texture2D" uid="uid://bq3b1hxl5ojh6" path="res://assets/icons/npc_emotes/attention.tres" id="2_4dxur"]
[ext_resource type="PackedScene" uid="uid://2q8dhf61a7os" path="res://assets/characters/engineer.tscn" id="3_gf736"]
[ext_resource type="Script" path="res://scenes/game_scene.gd" id="3_j7rx1"]
[ext_resource type="PackedScene" uid="uid://dhpc2xvlfln7o" path="res://objects/actionable.tscn" id="4_pths5"]
[ext_resource type="Resource" uid="uid://b1gd54koq1h7o" path="res://dialogue/testdialogue.dialogue" id="5_i1opu"]
[ext_resource type="PackedScene" uid="uid://dmagdl5pi6jdj" path="res://world/level.tscn" id="6_svjo8"]
[ext_resource type="PackedScene" uid="uid://dnobr4inhiskv" path="res://assets/3rdparty/kenney/platformer-kit/Models/GLB format/tree-pine.glb" id="7_0tqw3"]
[ext_resource type="PackedScene" uid="uid://m4tk7vhjy310" path="res://assets/3rdparty/kenney/platformer-kit/Models/GLB format/tree.glb" id="8_ivm2f"]
[ext_resource type="PackedScene" uid="uid://cgde10y3e7w86" path="res://assets/3rdparty/kenney/platformer-kit/Models/GLB format/rocks.glb" id="9_0hvyx"]
[ext_resource type="PackedScene" uid="uid://dg1rtct0vrk3p" path="res://assets/3rdparty/kenney/platformer-kit/Models/GLB format/poles.glb" id="10_8fhnl"]
[ext_resource type="PackedScene" uid="uid://cej0a41nm3eh7" path="res://assets/3rdparty/kenney/platformer-kit/Models/GLB format/mushrooms.glb" id="11_ytfwt"]
[ext_resource type="Script" path="res://player.gd" id="13_2wo8v"]
[ext_resource type="Script" path="res://quests/builder_missing_tool_quest.gd" id="14_g3xjj"]
[ext_resource type="PackedScene" uid="uid://dy8vjf760prhq" path="res://assets/characters/rogue.tscn" id="15_2476h"]
[ext_resource type="PackedScene" uid="uid://bo788o53t4rbq" path="res://scenes/startup_scene.tscn" id="16_7jwuc"]
[ext_resource type="Script" path="res://root_ui.gd" id="16_winq7"]
[ext_resource type="Theme" uid="uid://dmk7hc81l8gbw" path="res://ui/ui_theme.tres" id="17_1odts"]
[ext_resource type="Script" path="res://quests/scared_to_walk_in_the_dark.gd" id="18_7v3bk"]
[ext_resource type="Script" path="res://game_ui.gd" id="18_i4pxl"]
[ext_resource type="Script" path="res://ui/game_menu_ui.gd" id="18_lr26g"]
[ext_resource type="Texture2D" uid="uid://c7fu3paj3b4e8" path="res://assets/3rdparty/kenney/ui-pack-rpg-expansion/PNG/cursorSword_silver.png" id="19_mn7wc"]
[ext_resource type="Texture2D" uid="uid://drpl0ql1p3pfk" path="res://assets/3rdparty/kenney/ui-pack-rpg-expansion/PNG/cursorSword_gold.png" id="20_3b2hv"]
[ext_resource type="Texture2D" uid="uid://cq8ypeagpedq" path="res://assets/3rdparty/kenney/ui-pack-rpg-expansion/PNG/cursorSword_bronze.png" id="21_act8d"]
[ext_resource type="Script" path="res://ui/inventory_dialog.gd" id="22_s3l55"]
[ext_resource type="PackedScene" uid="uid://dp3fi0g53qrt2" path="res://ui/item_slot.tscn" id="23_4kchv"]
[ext_resource type="PackedScene" uid="uid://bwui4acukq4x6" path="res://ui/item_grid.tscn" id="24_hfjh5"]
[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_y65pc"]
[sub_resource type="Sky" id="Sky_wbut8"]
[sub_resource type="Sky" id="Sky_tw7u4"]
sky_material = SubResource("ProceduralSkyMaterial_y65pc")
[sub_resource type="Environment" id="Environment_v85yo"]
background_mode = 2
sky = SubResource("Sky_wbut8")
sky = SubResource("Sky_tw7u4")
ambient_light_source = 3
ambient_light_color = Color(0.662452, 0.662452, 0.662452, 1)
@ -61,620 +43,86 @@ height = 0.952333
radius = 0.194932
[node name="Game" type="Node3D"]
script = ExtResource("1_uwyoo")
[node name="StartupScene" parent="." instance=ExtResource("16_7jwuc")]
unique_name_in_owner = true
visible = false
[node name="WorldEnvironment" type="WorldEnvironment" parent="StartupScene"]
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
environment = SubResource("Environment_v85yo")
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="StartupScene"]
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
transform = Transform3D(0.836133, 0.124138, 0.534295, -0.548527, 0.189226, 0.81444, 0, -0.974055, 0.226311, 5.06819, 4.51394, 0)
shadow_enabled = true
[node name="GameScene" type="Node3D" parent="."]
unique_name_in_owner = true
visible = false
script = ExtResource("3_j7rx1")
[node name="WorldEnvironment" type="WorldEnvironment" parent="GameScene"]
environment = SubResource("Environment_v85yo")
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="GameScene"]
transform = Transform3D(0.836133, 0.124138, 0.534295, -0.548527, 0.189226, 0.81444, 0, -0.974055, 0.226311, 5.06819, 4.51394, 0)
shadow_enabled = true
[node name="Merchant" type="CharacterBody3D" parent="GameScene"]
[node name="Merchant" type="CharacterBody3D" parent="."]
unique_name_in_owner = true
transform = Transform3D(-4.37114e-08, 0, -1, 0, 1, 0, 1, 0, -4.37114e-08, 3.64783, 0, -1.58598)
[node name="CollisionShape3D" type="CollisionShape3D" parent="GameScene/Merchant"]
[node name="CollisionShape3D" type="CollisionShape3D" parent="Merchant"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.310637, 0)
shape = SubResource("CylinderShape3D_vq44x")
[node name="StateMarker" type="Sprite3D" parent="GameScene/Merchant"]
[node name="StateMarker" type="Sprite3D" parent="Merchant"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.0272007, 0.901301, 0.168392)
centered = false
billboard = 1
texture_filter = 0
texture = ExtResource("2_4dxur")
[node name="Geometry" type="Node3D" parent="GameScene/Merchant"]
[node name="Geometry" type="Node3D" parent="Merchant"]
transform = Transform3D(0.4, 0, 0, 0, 0.4, 0, 0, 0, 0.4, 0, 0, 0)
[node name="Engineer" parent="GameScene/Merchant/Geometry" instance=ExtResource("3_gf736")]
[node name="Engineer" parent="Merchant/Geometry" instance=ExtResource("3_gf736")]
[node name="Actionable" parent="GameScene/Merchant" instance=ExtResource("4_pths5")]
[node name="Actionable" parent="Merchant" instance=ExtResource("4_pths5")]
dialogue_resource = ExtResource("5_i1opu")
[node name="CollisionShape3D" type="CollisionShape3D" parent="GameScene/Merchant/Actionable"]
[node name="CollisionShape3D" type="CollisionShape3D" parent="Merchant/Actionable"]
shape = SubResource("SphereShape3D_6nrvr")
[node name="Level" parent="GameScene" instance=ExtResource("6_svjo8")]
[node name="Level" parent="." instance=ExtResource("6_svjo8")]
[node name="Decorations" type="Node3D" parent="GameScene"]
[node name="tree-pine2" parent="GameScene/Decorations" instance=ExtResource("7_0tqw3")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.754677, 0, 0.0391712)
[node name="tree2" parent="GameScene/Decorations" instance=ExtResource("8_ivm2f")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2.80764, 0, -3.13532)
[node name="rocks2" parent="GameScene/Decorations" instance=ExtResource("9_0hvyx")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.3817, -4.76837e-07, -3.3938)
[node name="poles2" parent="GameScene/Decorations" instance=ExtResource("10_8fhnl")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.56186, 0, -3.13331)
[node name="mushrooms2" parent="GameScene/Decorations" instance=ExtResource("11_ytfwt")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2.851, 0, 0.798104)
[node name="Bridge" type="Node3D" parent="GameScene"]
[node name="Bridge" type="Node3D" parent="."]
unique_name_in_owner = true
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.375699, -0.115042, 0)
[node name="Player" type="CharacterBody3D" parent="GameScene"]
[node name="Player" type="CharacterBody3D" parent="."]
unique_name_in_owner = true
script = ExtResource("13_2wo8v")
[node name="MeshInstance3D" type="MeshInstance3D" parent="GameScene/Player"]
[node name="MeshInstance3D" type="MeshInstance3D" parent="Player"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.3, 0)
visible = false
mesh = SubResource("CapsuleMesh_dwrtd")
[node name="CollisionShape3D" type="CollisionShape3D" parent="GameScene/Player"]
[node name="CollisionShape3D" type="CollisionShape3D" parent="Player"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.470516, 0)
shape = SubResource("CapsuleShape3D_7kfad")
[node name="Geometry" type="Node3D" parent="GameScene/Player"]
[node name="Geometry" type="Node3D" parent="Player"]
unique_name_in_owner = true
transform = Transform3D(0.4, 0, 0, 0, 0.4, 0, 0, 0, 0.4, 0, 0, 0)
[node name="Rogue" parent="GameScene/Player/Geometry" instance=ExtResource("15_2476h")]
[node name="Rogue" parent="Player/Geometry" instance=ExtResource("15_2476h")]
[node name="ActionableDetector" type="Area3D" parent="GameScene/Player"]
[node name="ActionableDetector" type="Area3D" parent="Player"]
unique_name_in_owner = true
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.325311)
collision_layer = 0
collision_mask = 16
[node name="CollisionShape3D" type="CollisionShape3D" parent="GameScene/Player/ActionableDetector"]
[node name="CollisionShape3D" type="CollisionShape3D" parent="Player/ActionableDetector"]
shape = SubResource("SphereShape3D_wrkyq")
[node name="Camera3D" type="Camera3D" parent="GameScene/Player"]
[node name="Camera3D" type="Camera3D" parent="Player"]
unique_name_in_owner = true
transform = Transform3D(1, 0, 0, 0, 0.460138, 0.887848, 0, -0.887848, 0.460138, 0, 2.91421, 1.186)
current = true
[node name="Quests" type="Node" parent="GameScene"]
[node name="Quests" type="Node" parent="."]
[node name="BuilderMissingTool" type="Node" parent="GameScene/Quests" groups=["quest_state"]]
[node name="BuilderMissingTool" type="Node" parent="Quests" groups=["quest_state"]]
unique_name_in_owner = true
script = ExtResource("14_g3xjj")
[node name="ScaredToWalkInTheDark" type="Node" parent="GameScene/Quests" groups=["quest_state"]]
[node name="ScaredToWalkInTheDark" type="Node" parent="Quests" groups=["quest_state"]]
script = ExtResource("18_7v3bk")
[node name="RootUI" type="CanvasLayer" parent="."]
unique_name_in_owner = true
script = ExtResource("16_winq7")
[node name="MainMenuUI" 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 = -134.5
offset_right = 199.0
offset_bottom = 134.5
grow_horizontal = 2
grow_vertical = 2
theme = ExtResource("17_1odts")
[node name="MarginContainer" type="MarginContainer" parent="RootUI/MainMenuUI"]
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/MainMenuUI/MarginContainer"]
layout_mode = 2
[node name="MarginContainer" type="MarginContainer" parent="RootUI/MainMenuUI/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="NewGameButton" type="Button" parent="RootUI/MainMenuUI/MarginContainer/VBoxContainer/MarginContainer"]
layout_mode = 2
text = "New Game"
[node name="MarginContainer4" type="MarginContainer" parent="RootUI/MainMenuUI/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/MainMenuUI/MarginContainer/VBoxContainer/MarginContainer4"]
layout_mode = 2
text = "Load Game
"
[node name="MarginContainer2" type="MarginContainer" parent="RootUI/MainMenuUI/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/MainMenuUI/MarginContainer/VBoxContainer/MarginContainer2"]
layout_mode = 2
text = "Options"
[node name="MarginContainer3" type="MarginContainer" parent="RootUI/MainMenuUI/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="QuitButton" type="Button" parent="RootUI/MainMenuUI/MarginContainer/VBoxContainer/MarginContainer3"]
layout_mode = 2
text = "Quit"
[node name="NewGameUI" 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 = -291.0
offset_top = -144.0
offset_right = 291.0
offset_bottom = 144.0
grow_horizontal = 2
grow_vertical = 2
theme = ExtResource("17_1odts")
[node name="MarginContainer" type="MarginContainer" parent="RootUI/NewGameUI"]
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/NewGameUI/MarginContainer"]
layout_mode = 2
[node name="Label" type="Label" parent="RootUI/NewGameUI/MarginContainer/VBoxContainer"]
layout_mode = 2
size_flags_horizontal = 4
size_flags_vertical = 6
text = "New Game"
[node name="MarginContainer" type="MarginContainer" parent="RootUI/NewGameUI/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="HBoxContainer" type="HBoxContainer" parent="RootUI/NewGameUI/MarginContainer/VBoxContainer/MarginContainer"]
layout_mode = 2
[node name="Label" type="Label" parent="RootUI/NewGameUI/MarginContainer/VBoxContainer/MarginContainer/HBoxContainer"]
layout_mode = 2
text = "World Name"
[node name="WorldNameEdit" type="TextEdit" parent="RootUI/NewGameUI/MarginContainer/VBoxContainer/MarginContainer/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
size_flags_stretch_ratio = 0.0
text = "Brave New World"
scroll_fit_content_height = true
[node name="MarginContainer2" type="MarginContainer" parent="RootUI/NewGameUI/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="CheckBox" type="CheckBox" parent="RootUI/NewGameUI/MarginContainer/VBoxContainer/MarginContainer2"]
layout_mode = 2
text = "Hardcore Mode"
[node name="MarginContainer3" type="MarginContainer" parent="RootUI/NewGameUI/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="HBoxContainer" type="HBoxContainer" parent="RootUI/NewGameUI/MarginContainer/VBoxContainer/MarginContainer3"]
layout_mode = 2
[node name="BackButton" type="Button" parent="RootUI/NewGameUI/MarginContainer/VBoxContainer/MarginContainer3/HBoxContainer"]
layout_mode = 2
text = "Back"
[node name="Control" type="Control" parent="RootUI/NewGameUI/MarginContainer/VBoxContainer/MarginContainer3/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
[node name="StartGameButton" type="Button" parent="RootUI/NewGameUI/MarginContainer/VBoxContainer/MarginContainer3/HBoxContainer"]
layout_mode = 2
text = "Start
"
[node name="GameUI" type="Control" parent="RootUI"]
unique_name_in_owner = true
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
size_flags_horizontal = 3
size_flags_vertical = 3
theme = ExtResource("17_1odts")
script = ExtResource("18_i4pxl")
[node name="MessagesContainer" type="MarginContainer" parent="RootUI/GameUI"]
unique_name_in_owner = true
visible = false
layout_mode = 1
anchors_preset = 5
anchor_left = 0.5
anchor_right = 0.5
offset_left = -244.5
offset_right = 244.5
offset_bottom = 67.0
grow_horizontal = 2
theme_override_constants/margin_top = 32
[node name="MessageTextEdit" type="TextEdit" parent="RootUI/GameUI/MessagesContainer"]
unique_name_in_owner = true
layout_mode = 2
text = "Picked Up Some Stuff !"
scroll_fit_content_height = true
[node name="MessageTimer" type="Timer" parent="RootUI/GameUI/MessagesContainer"]
unique_name_in_owner = true
wait_time = 2.0
[node name="InventoryDialog" type="MarginContainer" parent="RootUI/GameUI"]
unique_name_in_owner = true
visible = false
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme_override_constants/margin_left = 40
theme_override_constants/margin_top = 82
theme_override_constants/margin_right = 40
theme_override_constants/margin_bottom = 128
script = ExtResource("22_s3l55")
slot_scene = ExtResource("23_4kchv")
[node name="Panel" type="Panel" parent="RootUI/GameUI/InventoryDialog"]
layout_mode = 2
[node name="PanelContainer" type="VBoxContainer" parent="RootUI/GameUI/InventoryDialog/Panel"]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="Title" type="HBoxContainer" parent="RootUI/GameUI/InventoryDialog/Panel/PanelContainer"]
layout_mode = 2
size_flags_vertical = 0
[node name="Label" type="Label" parent="RootUI/GameUI/InventoryDialog/Panel/PanelContainer/Title"]
layout_mode = 2
size_flags_horizontal = 3
text = "Inventory"
horizontal_alignment = 1
[node name="CloseButton" type="Button" parent="RootUI/GameUI/InventoryDialog/Panel/PanelContainer/Title"]
layout_mode = 2
text = " X "
[node name="CraftingUI" type="MarginContainer" parent="RootUI/GameUI/InventoryDialog/Panel/PanelContainer"]
unique_name_in_owner = true
layout_mode = 2
size_flags_vertical = 3
theme_override_constants/margin_left = 16
theme_override_constants/margin_top = 16
theme_override_constants/margin_right = 16
theme_override_constants/margin_bottom = 16
[node name="HBoxContainer" type="HBoxContainer" parent="RootUI/GameUI/InventoryDialog/Panel/PanelContainer/CraftingUI"]
layout_mode = 2
theme_override_constants/separation = 17
[node name="Recipes" type="VBoxContainer" parent="RootUI/GameUI/InventoryDialog/Panel/PanelContainer/CraftingUI/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
[node name="Label" type="Label" parent="RootUI/GameUI/InventoryDialog/Panel/PanelContainer/CraftingUI/HBoxContainer/Recipes"]
layout_mode = 2
text = "Recipes"
[node name="RecipeList" type="ItemList" parent="RootUI/GameUI/InventoryDialog/Panel/PanelContainer/CraftingUI/HBoxContainer/Recipes"]
unique_name_in_owner = true
layout_mode = 2
size_flags_vertical = 3
theme = ExtResource("17_1odts")
item_count = 2
item_0/text = "Blab"
item_1/text = "Bloobalb"
[node name="CraftIngredients" type="VBoxContainer" parent="RootUI/GameUI/InventoryDialog/Panel/PanelContainer/CraftingUI/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
[node name="Label" type="Label" parent="RootUI/GameUI/InventoryDialog/Panel/PanelContainer/CraftingUI/HBoxContainer/CraftIngredients"]
layout_mode = 2
text = "Ingredients"
[node name="Panel" type="Panel" parent="RootUI/GameUI/InventoryDialog/Panel/PanelContainer/CraftingUI/HBoxContainer/CraftIngredients"]
layout_mode = 2
size_flags_vertical = 3
[node name="CenterContainer" type="CenterContainer" parent="RootUI/GameUI/InventoryDialog/Panel/PanelContainer/CraftingUI/HBoxContainer/CraftIngredients/Panel"]
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -254.5
offset_top = -32.0
offset_right = 254.5
offset_bottom = 32.0
grow_horizontal = 2
grow_vertical = 2
size_flags_vertical = 3
[node name="IngredientsContainer" parent="RootUI/GameUI/InventoryDialog/Panel/PanelContainer/CraftingUI/HBoxContainer/CraftIngredients/Panel/CenterContainer" instance=ExtResource("24_hfjh5")]
unique_name_in_owner = true
layout_mode = 2
[node name="HBoxContainer" type="HBoxContainer" parent="RootUI/GameUI/InventoryDialog/Panel/PanelContainer/CraftingUI/HBoxContainer/CraftIngredients"]
layout_mode = 2
alignment = 1
[node name="Control" type="Control" parent="RootUI/GameUI/InventoryDialog/Panel/PanelContainer/CraftingUI/HBoxContainer/CraftIngredients"]
layout_mode = 2
[node name="Label" type="Label" parent="RootUI/GameUI/InventoryDialog/Panel/PanelContainer/CraftingUI/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
size_flags_stretch_ratio = 0.2
text = "->"
horizontal_alignment = 1
[node name="CraftResult" type="VBoxContainer" parent="RootUI/GameUI/InventoryDialog/Panel/PanelContainer/CraftingUI/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
[node name="Label" type="Label" parent="RootUI/GameUI/InventoryDialog/Panel/PanelContainer/CraftingUI/HBoxContainer/CraftResult"]
layout_mode = 2
text = "Result"
[node name="Panel" type="Panel" parent="RootUI/GameUI/InventoryDialog/Panel/PanelContainer/CraftingUI/HBoxContainer/CraftResult"]
layout_mode = 2
size_flags_vertical = 3
[node name="CenterContainer" type="CenterContainer" parent="RootUI/GameUI/InventoryDialog/Panel/PanelContainer/CraftingUI/HBoxContainer/CraftResult/Panel"]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="ResultsContainer" parent="RootUI/GameUI/InventoryDialog/Panel/PanelContainer/CraftingUI/HBoxContainer/CraftResult/Panel/CenterContainer" instance=ExtResource("24_hfjh5")]
unique_name_in_owner = true
layout_mode = 2
[node name="HBoxContainer" type="HBoxContainer" parent="RootUI/GameUI/InventoryDialog/Panel/PanelContainer/CraftingUI/HBoxContainer/CraftResult"]
layout_mode = 2
alignment = 1
[node name="CraftButton" type="Button" parent="RootUI/GameUI/InventoryDialog/Panel/PanelContainer/CraftingUI/HBoxContainer/CraftResult/HBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
text = "Craft"
[node name="BackpackUI" type="MarginContainer" parent="RootUI/GameUI/InventoryDialog/Panel/PanelContainer"]
layout_mode = 2
size_flags_vertical = 3
theme_override_constants/margin_left = 16
theme_override_constants/margin_top = 16
theme_override_constants/margin_right = 16
theme_override_constants/margin_bottom = 16
[node name="VBoxContainer" type="VBoxContainer" parent="RootUI/GameUI/InventoryDialog/Panel/PanelContainer/BackpackUI"]
layout_mode = 2
[node name="Label" type="Label" parent="RootUI/GameUI/InventoryDialog/Panel/PanelContainer/BackpackUI/VBoxContainer"]
layout_mode = 2
text = "Backpack"
[node name="InventoryContainer" parent="RootUI/GameUI/InventoryDialog/Panel/PanelContainer/BackpackUI/VBoxContainer" instance=ExtResource("24_hfjh5")]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 4
size_flags_vertical = 4
[node name="GameMenuUI" type="PanelContainer" parent="RootUI/GameUI"]
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
offset_left = -199.0
offset_top = -215.0
offset_right = 199.0
offset_bottom = 215.0
grow_horizontal = 2
grow_vertical = 2
theme = ExtResource("17_1odts")
script = ExtResource("18_lr26g")
[node name="MarginContainer" type="MarginContainer" parent="RootUI/GameUI/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/GameUI/GameMenuUI/MarginContainer"]
layout_mode = 2
[node name="MarginContainer4" type="MarginContainer" parent="RootUI/GameUI/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/GameUI/GameMenuUI/MarginContainer/VBoxContainer/MarginContainer4"]
layout_mode = 2
text = "Save Game
"
[node name="MarginContainer6" type="MarginContainer" parent="RootUI/GameUI/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="LoadGameButton" type="Button" parent="RootUI/GameUI/GameMenuUI/MarginContainer/VBoxContainer/MarginContainer6"]
layout_mode = 2
text = "Load Game
"
[node name="MarginContainer2" type="MarginContainer" parent="RootUI/GameUI/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/GameUI/GameMenuUI/MarginContainer/VBoxContainer/MarginContainer2"]
layout_mode = 2
text = "Options"
[node name="MarginContainer3" type="MarginContainer" parent="RootUI/GameUI/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/GameUI/GameMenuUI/MarginContainer/VBoxContainer/MarginContainer3"]
layout_mode = 2
text = "Return to Game"
[node name="HSeparator" type="HSeparator" parent="RootUI/GameUI/GameMenuUI/MarginContainer/VBoxContainer"]
layout_mode = 2
[node name="MarginContainer5" type="MarginContainer" parent="RootUI/GameUI/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/GameUI/GameMenuUI/MarginContainer/VBoxContainer/MarginContainer5"]
layout_mode = 2
text = "Back to Main Menu"
[node name="ToolSlots" type="MarginContainer" parent="RootUI/GameUI"]
unique_name_in_owner = true
layout_mode = 1
anchors_preset = 7
anchor_left = 0.5
anchor_top = 1.0
anchor_right = 0.5
anchor_bottom = 1.0
offset_left = -87.0
offset_top = -101.0
offset_right = 87.0
grow_horizontal = 2
grow_vertical = 0
theme_override_constants/margin_bottom = 32
[node name="PanelContainer" type="PanelContainer" parent="RootUI/GameUI/ToolSlots"]
layout_mode = 2
[node name="HBoxContainer" type="HBoxContainer" parent="RootUI/GameUI/ToolSlots/PanelContainer"]
layout_mode = 2
[node name="Button2" type="Button" parent="RootUI/GameUI/ToolSlots/PanelContainer/HBoxContainer"]
layout_mode = 2
icon = ExtResource("19_mn7wc")
[node name="Button3" type="Button" parent="RootUI/GameUI/ToolSlots/PanelContainer/HBoxContainer"]
layout_mode = 2
icon = ExtResource("20_3b2hv")
[node name="Button" type="Button" parent="RootUI/GameUI/ToolSlots/PanelContainer/HBoxContainer"]
layout_mode = 2
icon = ExtResource("21_act8d")
[connection signal="visibility_changed" from="GameScene" to="GameScene" method="_on_visibility_changed"]
[connection signal="pressed" from="RootUI/MainMenuUI/MarginContainer/VBoxContainer/MarginContainer/NewGameButton" to="RootUI" method="_on_new_game_button_pressed"]
[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="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="visibility_changed" from="RootUI/GameUI/GameMenuUI" to="RootUI/GameUI" method="_on_game_menu_ui_visibility_changed"]
[connection signal="pressed" from="RootUI/GameUI/GameMenuUI/MarginContainer/VBoxContainer/MarginContainer4/SaveGameButton" to="." method="save_game"]
[connection signal="pressed" from="RootUI/GameUI/GameMenuUI/MarginContainer/VBoxContainer/MarginContainer6/LoadGameButton" to="." method="load_game"]
[connection signal="pressed" from="RootUI/GameUI/GameMenuUI/MarginContainer/VBoxContainer/MarginContainer3/BackToGameButton" to="RootUI" method="_on_start_game_button_pressed"]
[connection signal="pressed" from="RootUI/GameUI/GameMenuUI/MarginContainer/VBoxContainer/MarginContainer5/ToMainMenuButton" to="RootUI" method="_to_main_menu_button_pressed"]
[connection signal="visibility_changed" from="." to="." method="_on_visibility_changed"]

View File

@ -1,6 +0,0 @@
extends Node3D
@onready var camera_3d = %Camera3D
func _on_visibility_changed():
camera_3d.current = visible

View File

@ -1,22 +1,27 @@
class_name Game
class_name Main
extends Node3D
@onready var message_container:Control = %MessagesContainer
@onready var message_textedit:TextEdit = %MessageTextEdit
@onready var player = %Player
@onready var builder_missing_tool = %BuilderMissingTool
@onready var root_ui:RootUI = %RootUI
func save_game():
var player:Player = find_child("Player", true, false)
if player == null:
push_error("Cannot load game: no player found!")
return
var save_game:SaveGame = SaveGame.new()
save_game.player_transform = player.global_transform
for node:Node in get_tree().get_nodes_in_group("quest_state"):
save_game.quest_states[node.name] = {}
for property in node.get_property_list():
if (property.usage & PROPERTY_USAGE_STORAGE != 0) and (property.usage & PROPERTY_USAGE_SCRIPT_VARIABLE) != 0:
save_game.quest_states[node.name][property.name] = node.get(property.name)
@ -28,6 +33,12 @@ func save_game():
root_ui.activate_ui_panel(%GameUI)
func load_game():
var player:Player = find_child("Player", true, false)
if player == null:
push_error("Cannot load game: no player found!")
return
var save_game:SaveGame = load("user://savegame.tres") as SaveGame
player.global_transform = save_game.player_transform

527
scenes/main.tscn Normal file
View File

@ -0,0 +1,527 @@
[gd_scene load_steps=14 format=3 uid="uid://ck104ww8vi7f1"]
[ext_resource type="Script" path="res://scenes/main.gd" id="1_yidnr"]
[ext_resource type="PackedScene" uid="uid://bo788o53t4rbq" path="res://scenes/startup_scene.tscn" id="2_imuae"]
[ext_resource type="PackedScene" uid="uid://cqie4cy0uy1t0" path="res://scenes/game.tscn" id="2_o3qua"]
[ext_resource type="Script" path="res://root_ui.gd" id="13_h24kl"]
[ext_resource type="Theme" uid="uid://dmk7hc81l8gbw" path="res://ui/ui_theme.tres" id="14_bvivl"]
[ext_resource type="Script" path="res://game_ui.gd" id="15_g7bf1"]
[ext_resource type="Script" path="res://ui/inventory_dialog.gd" id="16_18k4v"]
[ext_resource type="PackedScene" uid="uid://dp3fi0g53qrt2" path="res://ui/item_slot.tscn" id="17_rucv3"]
[ext_resource type="PackedScene" uid="uid://bwui4acukq4x6" path="res://ui/item_grid.tscn" id="18_fihac"]
[ext_resource type="Script" path="res://ui/game_menu_ui.gd" id="19_krapk"]
[ext_resource type="Texture2D" uid="uid://c7fu3paj3b4e8" path="res://assets/3rdparty/kenney/ui-pack-rpg-expansion/PNG/cursorSword_silver.png" id="20_7s1r5"]
[ext_resource type="Texture2D" uid="uid://drpl0ql1p3pfk" path="res://assets/3rdparty/kenney/ui-pack-rpg-expansion/PNG/cursorSword_gold.png" id="21_663i3"]
[ext_resource type="Texture2D" uid="uid://cq8ypeagpedq" path="res://assets/3rdparty/kenney/ui-pack-rpg-expansion/PNG/cursorSword_bronze.png" id="22_le7qn"]
[node name="Main" type="Node3D"]
script = ExtResource("1_yidnr")
[node name="RootUI" type="CanvasLayer" parent="."]
unique_name_in_owner = true
script = ExtResource("13_h24kl")
startup_scene = ExtResource("2_imuae")
game_scene = ExtResource("2_o3qua")
[node name="MainMenuUI" 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 = -134.5
offset_right = 199.0
offset_bottom = 134.5
grow_horizontal = 2
grow_vertical = 2
theme = ExtResource("14_bvivl")
[node name="MarginContainer" type="MarginContainer" parent="RootUI/MainMenuUI"]
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/MainMenuUI/MarginContainer"]
layout_mode = 2
[node name="MarginContainer" type="MarginContainer" parent="RootUI/MainMenuUI/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="NewGameButton" type="Button" parent="RootUI/MainMenuUI/MarginContainer/VBoxContainer/MarginContainer"]
layout_mode = 2
text = "New Game"
[node name="MarginContainer4" type="MarginContainer" parent="RootUI/MainMenuUI/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/MainMenuUI/MarginContainer/VBoxContainer/MarginContainer4"]
layout_mode = 2
text = "Load Game
"
[node name="MarginContainer2" type="MarginContainer" parent="RootUI/MainMenuUI/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/MainMenuUI/MarginContainer/VBoxContainer/MarginContainer2"]
layout_mode = 2
text = "Options"
[node name="MarginContainer3" type="MarginContainer" parent="RootUI/MainMenuUI/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="QuitButton" type="Button" parent="RootUI/MainMenuUI/MarginContainer/VBoxContainer/MarginContainer3"]
layout_mode = 2
text = "Quit"
[node name="NewGameUI" 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 = -291.0
offset_top = -144.0
offset_right = 291.0
offset_bottom = 144.0
grow_horizontal = 2
grow_vertical = 2
theme = ExtResource("14_bvivl")
[node name="MarginContainer" type="MarginContainer" parent="RootUI/NewGameUI"]
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/NewGameUI/MarginContainer"]
layout_mode = 2
[node name="Label" type="Label" parent="RootUI/NewGameUI/MarginContainer/VBoxContainer"]
layout_mode = 2
size_flags_horizontal = 4
size_flags_vertical = 6
text = "New Game"
[node name="MarginContainer" type="MarginContainer" parent="RootUI/NewGameUI/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="HBoxContainer" type="HBoxContainer" parent="RootUI/NewGameUI/MarginContainer/VBoxContainer/MarginContainer"]
layout_mode = 2
[node name="Label" type="Label" parent="RootUI/NewGameUI/MarginContainer/VBoxContainer/MarginContainer/HBoxContainer"]
layout_mode = 2
text = "World Name"
[node name="WorldNameEdit" type="TextEdit" parent="RootUI/NewGameUI/MarginContainer/VBoxContainer/MarginContainer/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
size_flags_stretch_ratio = 0.0
text = "Brave New World"
scroll_fit_content_height = true
[node name="MarginContainer2" type="MarginContainer" parent="RootUI/NewGameUI/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="CheckBox" type="CheckBox" parent="RootUI/NewGameUI/MarginContainer/VBoxContainer/MarginContainer2"]
layout_mode = 2
text = "Hardcore Mode"
[node name="MarginContainer3" type="MarginContainer" parent="RootUI/NewGameUI/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="HBoxContainer" type="HBoxContainer" parent="RootUI/NewGameUI/MarginContainer/VBoxContainer/MarginContainer3"]
layout_mode = 2
[node name="BackButton" type="Button" parent="RootUI/NewGameUI/MarginContainer/VBoxContainer/MarginContainer3/HBoxContainer"]
layout_mode = 2
text = "Back"
[node name="Control" type="Control" parent="RootUI/NewGameUI/MarginContainer/VBoxContainer/MarginContainer3/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
[node name="StartGameButton" type="Button" parent="RootUI/NewGameUI/MarginContainer/VBoxContainer/MarginContainer3/HBoxContainer"]
layout_mode = 2
text = "Start
"
[node name="GameUI" type="Control" parent="RootUI"]
unique_name_in_owner = true
visible = false
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
size_flags_horizontal = 3
size_flags_vertical = 3
theme = ExtResource("14_bvivl")
script = ExtResource("15_g7bf1")
[node name="MessagesContainer" type="MarginContainer" parent="RootUI/GameUI"]
unique_name_in_owner = true
visible = false
layout_mode = 1
anchors_preset = 5
anchor_left = 0.5
anchor_right = 0.5
offset_left = -244.5
offset_right = 244.5
offset_bottom = 67.0
grow_horizontal = 2
theme_override_constants/margin_top = 32
[node name="MessageTextEdit" type="TextEdit" parent="RootUI/GameUI/MessagesContainer"]
unique_name_in_owner = true
layout_mode = 2
text = "Picked Up Some Stuff !"
scroll_fit_content_height = true
[node name="MessageTimer" type="Timer" parent="RootUI/GameUI/MessagesContainer"]
unique_name_in_owner = true
wait_time = 2.0
[node name="InventoryDialog" type="MarginContainer" parent="RootUI/GameUI"]
unique_name_in_owner = true
visible = false
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme_override_constants/margin_left = 40
theme_override_constants/margin_top = 82
theme_override_constants/margin_right = 40
theme_override_constants/margin_bottom = 128
script = ExtResource("16_18k4v")
slot_scene = ExtResource("17_rucv3")
[node name="Panel" type="Panel" parent="RootUI/GameUI/InventoryDialog"]
layout_mode = 2
[node name="PanelContainer" type="VBoxContainer" parent="RootUI/GameUI/InventoryDialog/Panel"]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="Title" type="HBoxContainer" parent="RootUI/GameUI/InventoryDialog/Panel/PanelContainer"]
layout_mode = 2
size_flags_vertical = 0
[node name="Label" type="Label" parent="RootUI/GameUI/InventoryDialog/Panel/PanelContainer/Title"]
layout_mode = 2
size_flags_horizontal = 3
text = "Inventory"
horizontal_alignment = 1
[node name="CloseButton" type="Button" parent="RootUI/GameUI/InventoryDialog/Panel/PanelContainer/Title"]
layout_mode = 2
text = " X "
[node name="CraftingUI" type="MarginContainer" parent="RootUI/GameUI/InventoryDialog/Panel/PanelContainer"]
unique_name_in_owner = true
layout_mode = 2
size_flags_vertical = 3
theme_override_constants/margin_left = 16
theme_override_constants/margin_top = 16
theme_override_constants/margin_right = 16
theme_override_constants/margin_bottom = 16
[node name="HBoxContainer" type="HBoxContainer" parent="RootUI/GameUI/InventoryDialog/Panel/PanelContainer/CraftingUI"]
layout_mode = 2
theme_override_constants/separation = 17
[node name="Recipes" type="VBoxContainer" parent="RootUI/GameUI/InventoryDialog/Panel/PanelContainer/CraftingUI/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
[node name="Label" type="Label" parent="RootUI/GameUI/InventoryDialog/Panel/PanelContainer/CraftingUI/HBoxContainer/Recipes"]
layout_mode = 2
text = "Recipes"
[node name="RecipeList" type="ItemList" parent="RootUI/GameUI/InventoryDialog/Panel/PanelContainer/CraftingUI/HBoxContainer/Recipes"]
unique_name_in_owner = true
layout_mode = 2
size_flags_vertical = 3
theme = ExtResource("14_bvivl")
item_count = 2
item_0/text = "Blab"
item_1/text = "Bloobalb"
[node name="CraftIngredients" type="VBoxContainer" parent="RootUI/GameUI/InventoryDialog/Panel/PanelContainer/CraftingUI/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
[node name="Label" type="Label" parent="RootUI/GameUI/InventoryDialog/Panel/PanelContainer/CraftingUI/HBoxContainer/CraftIngredients"]
layout_mode = 2
text = "Ingredients"
[node name="Panel" type="Panel" parent="RootUI/GameUI/InventoryDialog/Panel/PanelContainer/CraftingUI/HBoxContainer/CraftIngredients"]
layout_mode = 2
size_flags_vertical = 3
[node name="CenterContainer" type="CenterContainer" parent="RootUI/GameUI/InventoryDialog/Panel/PanelContainer/CraftingUI/HBoxContainer/CraftIngredients/Panel"]
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -254.5
offset_top = -32.0
offset_right = 254.5
offset_bottom = 32.0
grow_horizontal = 2
grow_vertical = 2
size_flags_vertical = 3
[node name="IngredientsContainer" parent="RootUI/GameUI/InventoryDialog/Panel/PanelContainer/CraftingUI/HBoxContainer/CraftIngredients/Panel/CenterContainer" instance=ExtResource("18_fihac")]
unique_name_in_owner = true
layout_mode = 2
[node name="HBoxContainer" type="HBoxContainer" parent="RootUI/GameUI/InventoryDialog/Panel/PanelContainer/CraftingUI/HBoxContainer/CraftIngredients"]
layout_mode = 2
alignment = 1
[node name="Control" type="Control" parent="RootUI/GameUI/InventoryDialog/Panel/PanelContainer/CraftingUI/HBoxContainer/CraftIngredients"]
layout_mode = 2
[node name="Label" type="Label" parent="RootUI/GameUI/InventoryDialog/Panel/PanelContainer/CraftingUI/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
size_flags_stretch_ratio = 0.2
text = "->"
horizontal_alignment = 1
[node name="CraftResult" type="VBoxContainer" parent="RootUI/GameUI/InventoryDialog/Panel/PanelContainer/CraftingUI/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
[node name="Label" type="Label" parent="RootUI/GameUI/InventoryDialog/Panel/PanelContainer/CraftingUI/HBoxContainer/CraftResult"]
layout_mode = 2
text = "Result"
[node name="Panel" type="Panel" parent="RootUI/GameUI/InventoryDialog/Panel/PanelContainer/CraftingUI/HBoxContainer/CraftResult"]
layout_mode = 2
size_flags_vertical = 3
[node name="CenterContainer" type="CenterContainer" parent="RootUI/GameUI/InventoryDialog/Panel/PanelContainer/CraftingUI/HBoxContainer/CraftResult/Panel"]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="ResultsContainer" parent="RootUI/GameUI/InventoryDialog/Panel/PanelContainer/CraftingUI/HBoxContainer/CraftResult/Panel/CenterContainer" instance=ExtResource("18_fihac")]
unique_name_in_owner = true
layout_mode = 2
[node name="HBoxContainer" type="HBoxContainer" parent="RootUI/GameUI/InventoryDialog/Panel/PanelContainer/CraftingUI/HBoxContainer/CraftResult"]
layout_mode = 2
alignment = 1
[node name="CraftButton" type="Button" parent="RootUI/GameUI/InventoryDialog/Panel/PanelContainer/CraftingUI/HBoxContainer/CraftResult/HBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
text = "Craft"
[node name="BackpackUI" type="MarginContainer" parent="RootUI/GameUI/InventoryDialog/Panel/PanelContainer"]
layout_mode = 2
size_flags_vertical = 3
theme_override_constants/margin_left = 16
theme_override_constants/margin_top = 16
theme_override_constants/margin_right = 16
theme_override_constants/margin_bottom = 16
[node name="VBoxContainer" type="VBoxContainer" parent="RootUI/GameUI/InventoryDialog/Panel/PanelContainer/BackpackUI"]
layout_mode = 2
[node name="Label" type="Label" parent="RootUI/GameUI/InventoryDialog/Panel/PanelContainer/BackpackUI/VBoxContainer"]
layout_mode = 2
text = "Backpack"
[node name="InventoryContainer" parent="RootUI/GameUI/InventoryDialog/Panel/PanelContainer/BackpackUI/VBoxContainer" instance=ExtResource("18_fihac")]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 4
size_flags_vertical = 4
[node name="GameMenuUI" type="PanelContainer" parent="RootUI/GameUI"]
unique_name_in_owner = true
visible = false
layout_mode = 1
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 = -215.0
offset_right = 199.0
offset_bottom = 215.0
grow_horizontal = 2
grow_vertical = 2
theme = ExtResource("14_bvivl")
script = ExtResource("19_krapk")
[node name="MarginContainer" type="MarginContainer" parent="RootUI/GameUI/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/GameUI/GameMenuUI/MarginContainer"]
layout_mode = 2
[node name="MarginContainer4" type="MarginContainer" parent="RootUI/GameUI/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/GameUI/GameMenuUI/MarginContainer/VBoxContainer/MarginContainer4"]
layout_mode = 2
text = "Save Game
"
[node name="MarginContainer6" type="MarginContainer" parent="RootUI/GameUI/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="LoadGameButton" type="Button" parent="RootUI/GameUI/GameMenuUI/MarginContainer/VBoxContainer/MarginContainer6"]
layout_mode = 2
text = "Load Game
"
[node name="MarginContainer2" type="MarginContainer" parent="RootUI/GameUI/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/GameUI/GameMenuUI/MarginContainer/VBoxContainer/MarginContainer2"]
layout_mode = 2
text = "Options"
[node name="MarginContainer3" type="MarginContainer" parent="RootUI/GameUI/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/GameUI/GameMenuUI/MarginContainer/VBoxContainer/MarginContainer3"]
layout_mode = 2
text = "Return to Game"
[node name="HSeparator" type="HSeparator" parent="RootUI/GameUI/GameMenuUI/MarginContainer/VBoxContainer"]
layout_mode = 2
[node name="MarginContainer5" type="MarginContainer" parent="RootUI/GameUI/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/GameUI/GameMenuUI/MarginContainer/VBoxContainer/MarginContainer5"]
layout_mode = 2
text = "Back to Main Menu"
[node name="ToolSlots" type="MarginContainer" parent="RootUI/GameUI"]
unique_name_in_owner = true
layout_mode = 1
anchors_preset = 7
anchor_left = 0.5
anchor_top = 1.0
anchor_right = 0.5
anchor_bottom = 1.0
offset_left = -87.0
offset_top = -101.0
offset_right = 87.0
grow_horizontal = 2
grow_vertical = 0
theme_override_constants/margin_bottom = 32
[node name="PanelContainer" type="PanelContainer" parent="RootUI/GameUI/ToolSlots"]
layout_mode = 2
[node name="HBoxContainer" type="HBoxContainer" parent="RootUI/GameUI/ToolSlots/PanelContainer"]
layout_mode = 2
[node name="Button2" type="Button" parent="RootUI/GameUI/ToolSlots/PanelContainer/HBoxContainer"]
layout_mode = 2
icon = ExtResource("20_7s1r5")
[node name="Button3" type="Button" parent="RootUI/GameUI/ToolSlots/PanelContainer/HBoxContainer"]
layout_mode = 2
icon = ExtResource("21_663i3")
[node name="Button" type="Button" parent="RootUI/GameUI/ToolSlots/PanelContainer/HBoxContainer"]
layout_mode = 2
icon = ExtResource("22_le7qn")
[node name="Scene" type="Node3D" parent="."]
unique_name_in_owner = true
[connection signal="pressed" from="RootUI/MainMenuUI/MarginContainer/VBoxContainer/MarginContainer/NewGameButton" to="RootUI" method="_on_new_game_button_pressed"]
[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="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="visibility_changed" from="RootUI/GameUI/GameMenuUI" to="RootUI/GameUI" method="_on_game_menu_ui_visibility_changed"]
[connection signal="pressed" from="RootUI/GameUI/GameMenuUI/MarginContainer/VBoxContainer/MarginContainer4/SaveGameButton" to="." method="save_game"]
[connection signal="pressed" from="RootUI/GameUI/GameMenuUI/MarginContainer/VBoxContainer/MarginContainer6/LoadGameButton" to="." method="load_game"]
[connection signal="pressed" from="RootUI/GameUI/GameMenuUI/MarginContainer/VBoxContainer/MarginContainer3/BackToGameButton" to="RootUI/GameUI" method="_on_back_to_game_button_pressed"]
[connection signal="pressed" from="RootUI/GameUI/GameMenuUI/MarginContainer/VBoxContainer/MarginContainer5/ToMainMenuButton" to="RootUI" method="_to_main_menu_button_pressed"]

View File

@ -1,6 +0,0 @@
extends Node3D
@onready var camera_3d = %Camera3D
func _on_visibility_changed():
camera_3d.current = visible

View File

@ -1,7 +1,6 @@
[gd_scene load_steps=13 format=3 uid="uid://bo788o53t4rbq"]
[gd_scene load_steps=15 format=3 uid="uid://bo788o53t4rbq"]
[ext_resource type="MeshLibrary" uid="uid://dcpuitbu16j1a" path="res://assets/mesh_library.tres" id="1_23vus"]
[ext_resource type="Script" path="res://scenes/startup_scene.gd" id="1_w7rl3"]
[ext_resource type="PackedScene" uid="uid://cofd468cwkntk" path="res://assets/scene_props/campfire_pit.tscn" id="2_m2sxe"]
[ext_resource type="PackedScene" uid="uid://dtlvapvk6brjn" path="res://assets/3rdparty/kenney/survival-kit/Models/tree-tall.glb" id="3_2dy0f"]
[ext_resource type="PackedScene" uid="uid://838tgcaf8b2v" path="res://assets/3rdparty/kenney/survival-kit/Models/tree.glb" id="4_osvg3"]
@ -13,8 +12,25 @@
[ext_resource type="PackedScene" uid="uid://c5fd67ak8kwtk" path="res://assets/3rdparty/kenney/platformer-kit/Models/GLB format/chest.glb" id="10_8gpnl"]
[ext_resource type="PackedScene" uid="uid://dy8vjf760prhq" path="res://assets/characters/rogue.tscn" id="11_4cmvr"]
[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_p271m"]
[sub_resource type="Sky" id="Sky_wbut8"]
sky_material = SubResource("ProceduralSkyMaterial_p271m")
[sub_resource type="Environment" id="Environment_a4xjk"]
background_mode = 2
sky = SubResource("Sky_wbut8")
ambient_light_source = 3
ambient_light_color = Color(0.662452, 0.662452, 0.662452, 1)
[node name="StartupScene" type="Node3D"]
script = ExtResource("1_w7rl3")
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
environment = SubResource("Environment_a4xjk")
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
transform = Transform3D(0.836133, 0.124138, 0.534295, -0.548527, 0.189226, 0.814439, 0, -0.974055, 0.226311, 5.06819, 4.51394, 0)
shadow_enabled = true
[node name="GridMap" type="GridMap" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.5, 0)

View File

@ -24,9 +24,9 @@ mesh_library = ExtResource("1_q0eym")
cell_size = Vector3(0.5, 0.5, 0.5)
cell_center_y = false
data = {
"cells": PackedInt32Array(1, 65534, 655374, 65534, 65534, 655374, 65534, 65531, 655374, 1, 65531, 655374, 4, 65534, 655374, 4, 65531, 655374, 65534, 1, 655374, 1, 1, 655374, 4, 1, 655374, 7, 1, 655374, 7, 65534, 655374, 7, 65531, 655374, 7, 65528, 655374, 4, 65528, 655374, 1, 65528, 655374, 65534, 65528, 655374, 13, 1, 1048590, 13, 65534, 1048590, 13, 65531, 1048590, 13, 65528, 1048590, 65531, 65528, 1048590, 65531, 65531, 1048590, 65531, 65534, 1048590, 65531, 1, 1048590, 65531, 65525, 1048590, 65534, 65525, 1048590, 1, 65525, 1048590, 4, 65525, 1048590, 7, 65525, 1048590, 13, 65525, 1048590, 7, 65522, 1048590, 4, 65522, 1048590, 1, 65522, 1048590, 65534, 65522, 1048590, 65531, 65522, 1048590, 65531, 4, 1048590, 65534, 4, 1048590, 1, 4, 1048590, 4, 4, 1048590, 7, 4, 1048590, 65543, 65527, 9, 65541, 65527, 9, 65538, 65527, 9, 131067, 65527, 9, 131066, 65529, 1441801, 131066, 65532, 1441801, 131066, 65535, 1441801, 131066, 1, 1441801, 131066, 4, 1441801, 131068, 5, 655369, 131071, 5, 655369, 65538, 5, 655369, 65541, 5, 655369, 65543, 5, 9, 65544, 4, 1441801, 65544, 1, 1441801, 15, 65521, 13, 15, 65522, 13, 15, 65523, 13, 15, 65524, 13, 15, 65525, 13, 15, 65526, 13, 16, 65527, 13, 16, 65528, 13, 15, 65528, 13, 15, 65529, 13, 15, 65530, 13)
"cells": PackedInt32Array(1, 65534, 655374, 1, 65531, 655374, 4, 65534, 655374, 4, 65531, 655374, 65534, 1, 655374, 1, 1, 655374, 4, 1, 655374, 7, 1, 655374, 7, 65534, 655374, 7, 65531, 655374, 7, 65528, 655374, 4, 65528, 13, 13, 1, 1048590, 13, 65534, 1048590, 13, 65531, 1048590, 13, 65528, 1048590, 65531, 65528, 1048590, 65531, 65531, 1048590, 65531, 65534, 1048590, 65531, 1, 1048590, 65531, 65525, 1048590, 65534, 65525, 1048590, 1, 65525, 1048590, 4, 65525, 1048590, 7, 65525, 1048590, 13, 65525, 1048590, 7, 65522, 1048590, 4, 65522, 1048590, 1, 65522, 1048590, 65534, 65522, 1048590, 65531, 65522, 1048590, 65531, 4, 1048590, 65534, 4, 1048590, 1, 4, 1048590, 4, 4, 1048590, 7, 4, 1048590, 65543, 65527, 9, 65541, 65527, 9, 131067, 65527, 9, 131066, 65529, 1441801, 131066, 4, 1441801, 131068, 5, 655369, 131071, 5, 655369, 65538, 5, 655369, 65541, 5, 655369, 65543, 5, 9, 65544, 4, 1441801, 65544, 1, 1441801, 15, 65521, 13, 15, 65522, 13, 15, 65523, 13, 15, 65524, 13, 15, 65525, 13, 15, 65526, 13, 16, 65527, 13, 16, 65528, 13, 15, 65528, 13, 15, 65529, 13, 15, 65530, 13, 65534, 65528, 13, 65534, 65529, 13, 65534, 65530, 13, 65534, 65531, 13, 65534, 65532, 13, 65534, 65533, 13, 65534, 65534, 13, 65534, 65535, 13, 65535, 65535, 13, 65535, 65534, 13, 65535, 65533, 13, 65535, 65532, 13, 65535, 65531, 13, 65535, 65530, 13, 65535, 65529, 13, 65535, 65528, 13, 65535, 65527, 13, 65534, 65527, 13, 65533, 65527, 13, 65533, 65526, 13, 65532, 65528, 13, 65533, 65528, 13, 0, 65528, 13, 0, 65527, 13, 1, 65527, 13, 1, 65528, 13, 2, 65528, 13, 3, 65528, 13, 5, 65528, 13)
}
metadata/_editor_floor_ = Vector3(0, 0, 0)
metadata/_editor_floor_ = Vector3(0, 1, 0)
[node name="Objects" type="Node3D" parent="."]