diff --git a/Assets/MapSymbol.aseprite b/Assets/MapSymbol.aseprite new file mode 100644 index 0000000..0e3e520 Binary files /dev/null and b/Assets/MapSymbol.aseprite differ diff --git a/Assets/MapSymbol.png b/Assets/MapSymbol.png new file mode 100644 index 0000000..c1fa909 Binary files /dev/null and b/Assets/MapSymbol.png differ diff --git a/Assets/MapSymbol.png.import b/Assets/MapSymbol.png.import new file mode 100644 index 0000000..485e2a7 --- /dev/null +++ b/Assets/MapSymbol.png.import @@ -0,0 +1,40 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://d068gyi3e48cv" +path="res://.godot/imported/MapSymbol.png-12998dcead6e19bcc0954353e168f273.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Assets/MapSymbol.png" +dest_files=["res://.godot/imported/MapSymbol.png-12998dcead6e19bcc0954353e168f273.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/Scenes/Game.tscn b/Scenes/Game.tscn index d5d4237..41134af 100644 --- a/Scenes/Game.tscn +++ b/Scenes/Game.tscn @@ -10,6 +10,7 @@ [ext_resource type="Script" uid="uid://fegfbcnlk8p5" path="res://Scripts/WorldGeneration/Map.cs" id="8_bf53h"] [ext_resource type="Texture2D" uid="uid://deuxffyhsrinn" path="res://Assets/EnergySymbol.png" id="9_71axn"] [ext_resource type="Texture2D" uid="uid://dje86ro2e37xl" path="res://Assets/WaterSymbol.png" id="10_71axn"] +[ext_resource type="Texture2D" uid="uid://d068gyi3e48cv" path="res://Assets/MapSymbol.png" id="11_3cx6b"] [ext_resource type="Texture2D" uid="uid://ban872p4eh4gi" path="res://Assets/RobotSymbol.png" id="11_dahhg"] [ext_resource type="Texture2D" uid="uid://b77mo4fhklnja" path="res://Assets/OptionsSymbol.png" id="12_3so38"] @@ -95,6 +96,43 @@ grow_vertical = 2 layout_mode = 2 theme_override_styles/panel = SubResource("StyleBoxFlat_b2bpf") +[node name="VBoxContainer" type="HBoxContainer" parent="CanvasLayer/UIHandler/MainUI/HeaderContainer" unique_id=536619770] +layout_mode = 2 + +[node name="RowEnergy" type="HBoxContainer" parent="CanvasLayer/UIHandler/MainUI/HeaderContainer/VBoxContainer" unique_id=867560906] +layout_mode = 2 + +[node name="TextureRect" type="TextureRect" parent="CanvasLayer/UIHandler/MainUI/HeaderContainer/VBoxContainer/RowEnergy" unique_id=1218525340] +layout_mode = 2 +texture = ExtResource("9_71axn") +expand_mode = 2 + +[node name="RichTextLabel" type="RichTextLabel" parent="CanvasLayer/UIHandler/MainUI/HeaderContainer/VBoxContainer/RowEnergy" unique_id=32920400] +layout_mode = 2 +size_flags_horizontal = 3 +text = "Energy: 100/100" +fit_content = true +autowrap_mode = 0 +horizontal_alignment = 1 +vertical_alignment = 1 + +[node name="RowWater" type="HBoxContainer" parent="CanvasLayer/UIHandler/MainUI/HeaderContainer/VBoxContainer" unique_id=465013052] +layout_mode = 2 + +[node name="TextureRect" type="TextureRect" parent="CanvasLayer/UIHandler/MainUI/HeaderContainer/VBoxContainer/RowWater" unique_id=1398125603] +layout_mode = 2 +texture = ExtResource("10_71axn") +expand_mode = 2 + +[node name="RichTextLabel" type="RichTextLabel" parent="CanvasLayer/UIHandler/MainUI/HeaderContainer/VBoxContainer/RowWater" unique_id=1355787203] +layout_mode = 2 +size_flags_horizontal = 3 +text = "Water: 100/100" +fit_content = true +autowrap_mode = 0 +horizontal_alignment = 1 +vertical_alignment = 1 + [node name="Content" type="Control" parent="CanvasLayer/UIHandler/MainUI" unique_id=45665557] layout_mode = 2 size_flags_vertical = 3 @@ -315,48 +353,6 @@ text = "Exit" visible = false layout_mode = 1 -[node name="Survival" type="PanelContainer" parent="CanvasLayer/UIHandler/MainUI/Content" unique_id=141921319] -layout_mode = 1 -offset_right = 150.0 -offset_bottom = 23.0 - -[node name="VBoxContainer" type="VBoxContainer" parent="CanvasLayer/UIHandler/MainUI/Content/Survival" unique_id=1716446061] -layout_mode = 2 - -[node name="RowEnergy" type="HBoxContainer" parent="CanvasLayer/UIHandler/MainUI/Content/Survival/VBoxContainer" unique_id=867560906] -layout_mode = 2 - -[node name="TextureRect" type="TextureRect" parent="CanvasLayer/UIHandler/MainUI/Content/Survival/VBoxContainer/RowEnergy" unique_id=1218525340] -layout_mode = 2 -texture = ExtResource("9_71axn") -expand_mode = 2 - -[node name="RichTextLabel" type="RichTextLabel" parent="CanvasLayer/UIHandler/MainUI/Content/Survival/VBoxContainer/RowEnergy" unique_id=32920400] -layout_mode = 2 -size_flags_horizontal = 3 -text = "Energy: 100/100" -fit_content = true -autowrap_mode = 0 -horizontal_alignment = 1 -vertical_alignment = 1 - -[node name="RowWater" type="HBoxContainer" parent="CanvasLayer/UIHandler/MainUI/Content/Survival/VBoxContainer" unique_id=465013052] -layout_mode = 2 - -[node name="TextureRect" type="TextureRect" parent="CanvasLayer/UIHandler/MainUI/Content/Survival/VBoxContainer/RowWater" unique_id=1398125603] -layout_mode = 2 -texture = ExtResource("10_71axn") -expand_mode = 2 - -[node name="RichTextLabel" type="RichTextLabel" parent="CanvasLayer/UIHandler/MainUI/Content/Survival/VBoxContainer/RowWater" unique_id=1355787203] -layout_mode = 2 -size_flags_horizontal = 3 -text = "Water: 100/100" -fit_content = true -autowrap_mode = 0 -horizontal_alignment = 1 -vertical_alignment = 1 - [node name="FooterContainer" type="PanelContainer" parent="CanvasLayer/UIHandler/MainUI" unique_id=1495029884] layout_mode = 2 @@ -375,12 +371,19 @@ layout_mode = 2 fit_content = true autowrap_mode = 0 +[node name="Map" type="TextureButton" parent="CanvasLayer/UIHandler/MainUI/FooterContainer/HBoxContainer" unique_id=1320346210] +layout_mode = 2 +tooltip_text = "Map (M)" +texture_normal = ExtResource("11_3cx6b") + [node name="Robots" type="TextureButton" parent="CanvasLayer/UIHandler/MainUI/FooterContainer/HBoxContainer" unique_id=1666653447] layout_mode = 2 +tooltip_text = "Robots (R)" texture_normal = ExtResource("11_dahhg") [node name="Options" type="TextureButton" parent="CanvasLayer/UIHandler/MainUI/FooterContainer/HBoxContainer" unique_id=1930105751] layout_mode = 2 +tooltip_text = "Menu (ESC)" texture_normal = ExtResource("12_3so38") [connection signal="button_up" from="CanvasLayer/UIHandler/MainUI/Content/CodingWindow/VBoxContainer/Scripting/EditorWindow/Buttons/Clear" to="CanvasLayer/UIHandler/MainUI/Content/CodingWindow" method="ClearWindow"] @@ -388,3 +391,6 @@ texture_normal = ExtResource("12_3so38") [connection signal="pressed" from="CanvasLayer/UIHandler/MainUI/Content/Menu/VBoxContainer/Button" to="CanvasLayer/UIHandler" method="HandleMenu"] [connection signal="pressed" from="CanvasLayer/UIHandler/MainUI/Content/Menu/VBoxContainer/Button2" to="CanvasLayer/UIHandler" method="ShowOptions"] [connection signal="pressed" from="CanvasLayer/UIHandler/MainUI/Content/Menu/VBoxContainer/Button3" to="CanvasLayer/UIHandler" method="ExitGame"] +[connection signal="pressed" from="CanvasLayer/UIHandler/MainUI/FooterContainer/HBoxContainer/Map" to="CanvasLayer/UIHandler/MainUI/Content/Map" method="ShowMap"] +[connection signal="pressed" from="CanvasLayer/UIHandler/MainUI/FooterContainer/HBoxContainer/Robots" to="CanvasLayer/UIHandler/MainUI/Content/RobotList" method="ShowList"] +[connection signal="pressed" from="CanvasLayer/UIHandler/MainUI/FooterContainer/HBoxContainer/Options" to="CanvasLayer/UIHandler" method="HandleMenu"] diff --git a/Scripts/Helpers/UIHandler.cs b/Scripts/Helpers/UIHandler.cs index ced7ab8..f02f1c5 100644 --- a/Scripts/Helpers/UIHandler.cs +++ b/Scripts/Helpers/UIHandler.cs @@ -30,11 +30,7 @@ public partial class UIHandler : Control if (Input.IsActionJustPressed("map")) { - map.Visible = !map.Visible; - if (map.Visible) - { - map.ShowMap(); - } + map.ShowMap(); } if (Input.IsActionJustPressed("menu")) diff --git a/Scripts/Robot/RobotList.cs b/Scripts/Robot/RobotList.cs index 06d1cbb..31270dc 100644 --- a/Scripts/Robot/RobotList.cs +++ b/Scripts/Robot/RobotList.cs @@ -18,11 +18,16 @@ public partial class RobotList : PanelContainer { if (Input.IsActionJustPressed("robot_list")) { - Visible = !Visible; - if (Visible) ReloadRobots(); + ShowList(); } } + public void ShowList() + { + Visible = !Visible; + if (Visible) ReloadRobots(); + } + public void ReloadRobots() { foreach (Node node in robotList.GetChildren()) diff --git a/Scripts/WorldGeneration/Map.cs b/Scripts/WorldGeneration/Map.cs index 679d681..ec3bffc 100644 --- a/Scripts/WorldGeneration/Map.cs +++ b/Scripts/WorldGeneration/Map.cs @@ -13,11 +13,14 @@ public partial class Map : PanelContainer // Called every frame. 'delta' is the elapsed time since the previous frame. public override void _Process(double delta) { - + } public void ShowMap() { + + Visible = !Visible; + if (!Visible) return; foreach (Node node in grid.GetChildren()) { grid.RemoveChild(node); @@ -45,7 +48,7 @@ public partial class Map : PanelContainer { label.Text = "\u2193 Z | \u2192 X"; } - else if(z == -1) + else if (z == -1) { label.Text = x.ToString(); } @@ -54,7 +57,7 @@ public partial class Map : PanelContainer label.Text = z.ToString(); } grid.AddChild(label); - continue; + continue; } texture = new TextureRect(); if (tiles[x, z].wasVisited) diff --git a/Scripts/WorldGeneration/World.cs b/Scripts/WorldGeneration/World.cs index f1a17b8..d3a4ab0 100644 --- a/Scripts/WorldGeneration/World.cs +++ b/Scripts/WorldGeneration/World.cs @@ -46,6 +46,14 @@ public partial class World : Node3D Pathfinding.BuildAStarGraph(); HandleRenderData(BuildRenderData(0)); + + //TODO: Remove for live build -> DEBUG ONLY + + Robot robot = ResourceLoader.LoadRobotPrefab().Instantiate(); + robot.Name = $"Robot #{robots.Count + 1}"; + robot.Position = map[0].tiles[0, 0].Position; + AddChild(robot); + robots.Add(robot); } private Dictionary CreateMultiMeshes(Dictionary meshLibrary) @@ -78,22 +86,13 @@ public partial class World : Node3D { if (!canMove) return; if (Input.IsActionJustPressed("layer_up") && currentLayer > 0) currentLayer--; - if (Input.IsActionJustPressed("layer_down") && currentLayer < ruinSize - 1) currentLayer++; + if (Input.IsActionJustPressed("layer_down") && currentLayer < ruinSize - 1 && map[currentLayer].isGateOpen) currentLayer++; if (currentLayer != visibleLayer) { map[visibleLayer].ClearDecorations(); HandleRenderData(BuildRenderData(currentLayer)); visibleLayer = currentLayer; } - - if (Input.IsActionJustPressed("spawn_robot") && robots.Count < maxRobotCount) - { - Robot robot = ResourceLoader.LoadRobotPrefab().Instantiate(); - robot.Name = $"Robot #{robots.Count + 1}"; - robot.Position = map[0].tiles[0, 0].Position; - AddChild(robot); - robots.Add(robot); - } } private void GenerateWorld() diff --git a/project.godot b/project.godot index 64e3846..e99b3de 100644 --- a/project.godot +++ b/project.godot @@ -72,11 +72,6 @@ sprint={ "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":4194325,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null) ] } -spawn_robot={ -"deadzone": 0.2, -"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) -] -} robot_list={ "deadzone": 0.2, "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":82,"key_label":0,"unicode":114,"location":0,"echo":false,"script":null)