I made a little button on the main screen of my game to access createHero.tscn. The hero class (Cleric, Druid, Ranger, etc.) buttons are in an HBox that manages their left-to-right spacing.I set its minimum width to 420 so that the other thing in the HBoxContainer2, the “Rename” button, gets pushed to the right side of the screen. “container_spacer” is a generic Container node.There’s an open space below the “Create Hero” label that I will use to display the hero art later on.For now, it’s just made out of unskinned/unstyled Godot nodes. My scene now contains a VBox parent with three children: a label, an HBox, and another HBox. This builds on the concepts already explained. Each “row” is a container, element (such as a label or a button), or an HBox with child elements of its own.įor the sake of brevity I’ve skipped ahead to my assembled scene. This stack represents a VBox with child elements. This system takes a little practice to get used to, but hopefully this diagram made of children’s blocks helps clarify the general concepts. Or, each element could be something more complex, such as an HBox (which would let you create a row of buttons, labels, or similar). You can also control the VBox’s width and the spacing between its child elements.Įach element in the stack can be something simple, such as a label or a button, and it will occupy as much vertical space as it is tall. The VBox stacks its children elements vertically (one on top of the other) which saves you from having to position each one individually and from having to worry about overlapping elements. Let’s talk about structuring a menu in Godot.įor a menu with many “sections” or “elements” that read top-to-bottom, use a VBoxContainer. The first child of the VBoxContainer is a label. The first thing I did was make a new scene and add a Node2D to serve as the parent node and a VBoxContainer as its child to hold all of the major elements of this menu. Structuring the scene: Godot container types explained Hopefully this “slice” of the game’s development is still helpful to someone, even if it doesn’t start from scratch. PS: The project I’m using for this guide already exists (in some capacity), so there are references to things that are already built prior to this guide. Altering aspects of a “hero” scene, such as its name and head sprite.Hooking that menu up to the rest of the game.Building a simple menu out of Godot nodes.Godot’s container system (VBoxContainer, HBoxContainer, etc).Some of the things covered in this guide include: I’ve been working in Godot on a hobby project for about 5 months now and I think the engine is great but could use a few more tutorials and “here’s how I did it” type stuff, so here we go. This work managed to touch on a lot of concepts, so I thought I’d share my work here in hopes that it’ll help someone else. I recently added a menu to my game that lets the player create their own custom character for the game. Jim Grant, full stack JavaScript developer, lover of esoteric language features and science fiction. Mandi Burley, full stack JavaScript developer, WordPress fixer-upper, and occasional artist. The more frustrating something was, the more likely it is to end up here on this site! Here, we share little discoveries made along the way. A lot happens between “Hello World” and “Supreme Master Programmer”.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |