{"id":79,"date":"2024-12-11T07:36:00","date_gmt":"2024-12-11T14:36:00","guid":{"rendered":"https:\/\/kennebel.com\/blog\/?p=79"},"modified":"2024-12-15T12:35:39","modified_gmt":"2024-12-15T19:35:39","slug":"broadside-update-1-menus-and-scenes-and-files","status":"publish","type":"post","link":"https:\/\/kennebel.com\/blog\/2024\/12\/11\/broadside-update-1-menus-and-scenes-and-files\/","title":{"rendered":"Broadside, Update #1 &#8211; Menus and Scenes (and files)"},"content":{"rendered":"\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1148\" height=\"714\" src=\"https:\/\/kennebel.com\/blog\/wp-content\/uploads\/2024\/12\/Broadside_menu_20241210.gif\" alt=\"\" class=\"wp-image-80\"\/><\/figure>\n\n\n\n<p>Table of Contents<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Overview<\/li>\n\n\n\n<li>UI&#8217;s<\/li>\n\n\n\n<li>Resources<\/li>\n\n\n\n<li>Bonus: Godot File\/Folder management<\/li>\n\n\n\n<li>Links<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Overview<\/h2>\n\n\n\n<p>This update session, I worked on building a rudimentary user interface, and looked at how to switch between scenes. I also learned about the option to have Godot ignore a folder, so you can put files in the project, that won&#8217;t be a part of the development process.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">UI&#8217;s<\/h2>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"688\" src=\"https:\/\/kennebel.com\/blog\/wp-content\/uploads\/2024\/12\/Screenshot-from-2024-12-10-14-16-41-1024x688.png\" alt=\"\" class=\"wp-image-81\" srcset=\"https:\/\/kennebel.com\/blog\/wp-content\/uploads\/2024\/12\/Screenshot-from-2024-12-10-14-16-41-1024x688.png 1024w, https:\/\/kennebel.com\/blog\/wp-content\/uploads\/2024\/12\/Screenshot-from-2024-12-10-14-16-41-300x201.png 300w, https:\/\/kennebel.com\/blog\/wp-content\/uploads\/2024\/12\/Screenshot-from-2024-12-10-14-16-41-768x516.png 768w, https:\/\/kennebel.com\/blog\/wp-content\/uploads\/2024\/12\/Screenshot-from-2024-12-10-14-16-41.png 1087w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>The Godot Engine combines a 2D rendering engine with a 3D rendering engine. By adding a &#8220;CanvasLayer&#8221; object in your 3D scene hierarchy (renamed to TopMenu here), you can add UI controls, manage their placement, and wire them up for actions. In this case, I used a &#8220;VBoxContainer&#8221;, which by default auto sizes based on content, and lays out each control vertically, in the order it is listed in the hierarchy.<\/p>\n\n\n\n<p>When you place a control, like the VBoxContainer, you will notice in the inspector, Layout Section, that there is a notification\/warning message: &#8220;This node doesn&#8217;t have a control parent&#8221;. All this means is that the placement is entirely on the settings you provide, rather than inheriting the location, anchors, and all that. This will not impact the functionality of the control at all. It is safe to ignore that and move on if you know it is supposed to not have a parent Control managing it.<\/p>\n\n\n\n<p>For the scene with the ships, i used the HBoxContainer to easily place the buttons horizontally along the top.<\/p>\n\n\n\n<p>With the buttons set up, I was able to switch between scenes easily!<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Resources<\/h2>\n\n\n\n<p><a href=\"https:\/\/docs.godotengine.org\/en\/stable\/tutorials\/scripting\/resources.html\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/docs.godotengine.org\/en\/stable\/tutorials\/scripting\/resources.html<\/a><\/p>\n\n\n\n<p>A resource file is a way to have data accessible to Godot scripts, while avoiding the usual problems of data storage and <a href=\"https:\/\/en.wikipedia.org\/wiki\/Object%E2%80%93relational_mapping\" target=\"_blank\" rel=\"noreferrer noopener\">ORM<\/a> issues. This allows you to create a class to store data, have the system save the information directly from the class. I have set one up, but haven&#8217;t tried to save\/reload data over multiple sessions yet.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Bonus: Godot File\/Folder management<\/h2>\n\n\n\n<p>In the documentation, there is a section called <a href=\"https:\/\/docs.godotengine.org\/en\/stable\/tutorials\/best_practices\/project_organization.html#ignoring-specific-folders\" target=\"_blank\" rel=\"noreferrer noopener\">Project organization<\/a>, which covers some basic folder strategies. More importantly, it mentions the fact that if you add an empty file called &#8220;.gdignore&#8221;, the Godot Editor will ignore that folder. This means that it will not show up in the Editor UI, and it will not try to &#8220;import&#8221; anything in that folder. Since I created a folder to save progress screenshots, and they were being brought in to the game unnecessarily, this was a great find. \ud83d\ude42<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Links<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/godotengine.org\/\" target=\"_blank\" rel=\"noreferrer noopener\">Godot Engine<\/a><\/li>\n\n\n\n<li>Godot Docs: <a href=\"https:\/\/docs.godotengine.org\/en\/stable\/tutorials\/best_practices\/project_organization.html#ignoring-specific-folders\" target=\"_blank\" rel=\"noreferrer noopener\">Project Organization<\/a><\/li>\n\n\n\n<li>Github: <a href=\"https:\/\/github.com\/kennebel\/Broadside\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/github.com\/kennebel\/Broadside<\/a><\/li>\n\n\n\n<li>Specific Commit: <a href=\"https:\/\/github.com\/kennebel\/Broadside\/commit\/2c2efe1b693fa05579cd4310a4b4fa606e7f20e0\">https:\/\/github.com\/kennebel\/Broadside\/commit\/2c2efe1b693fa05579cd4310a4b4fa606e7f20e0<\/a><\/li>\n<\/ul>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Table of Contents Overview This update session, I worked on building a rudimentary user interface, and looked at how to switch between scenes. I also learned about the option to have Godot ignore a folder, so you can put files in the project, that won&#8217;t be a part of the development process. UI&#8217;s The Godot [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[],"class_list":["post-79","post","type-post","status-publish","format-standard","hentry","category-programming"],"_links":{"self":[{"href":"https:\/\/kennebel.com\/blog\/wp-json\/wp\/v2\/posts\/79","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kennebel.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kennebel.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kennebel.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kennebel.com\/blog\/wp-json\/wp\/v2\/comments?post=79"}],"version-history":[{"count":6,"href":"https:\/\/kennebel.com\/blog\/wp-json\/wp\/v2\/posts\/79\/revisions"}],"predecessor-version":[{"id":102,"href":"https:\/\/kennebel.com\/blog\/wp-json\/wp\/v2\/posts\/79\/revisions\/102"}],"wp:attachment":[{"href":"https:\/\/kennebel.com\/blog\/wp-json\/wp\/v2\/media?parent=79"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kennebel.com\/blog\/wp-json\/wp\/v2\/categories?post=79"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kennebel.com\/blog\/wp-json\/wp\/v2\/tags?post=79"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}