Godot Learning - Part 4
- Separate node for running the logic of the dialogue box
- Like Vue data/computed/methods separated from template, but more manual lifting
- Player is a state machine based on input dialogue data
- DB object to get assets
- Can iterate over a
res:// directory with
Directory instance and cursor
- Can create text Resources as an alternative data storage vs. JSON/YAML
- Using YAML: https://github.com/Beliaar/godot-yaml-asset
- If we need JSON for native, switching out loaders should be easy
- GUI containers:
- Create a
CanvasLayer overtop of everything where GUIs live, otherwise
they’ll be affected by the viewport/
- Docs say that
Containers and their children reflow automatically, but I
found I had to reset settings a lot in child containers after adjusting
parent containers to get them “right”.
- Getting a
ColorRect to take up the whole container’s background is a challenge.
MarginContainer Custom Constants is where you’re setting the interior margins
of the box! This is the setting you want to make a
MarginContainer do what
you expect it to do!
(H|V)BoxContainers with the Size Flag set to
Expand to create spacers.
Solving “Move RPG dialogue box to other end of screen to not hide player”
- Put the
DialogueBox inside a
VBoxContainer, I call it
- Player is above the centerline of the viewport if
global_position.y < $Camera.get_camera_screen_center().y.
- Set that on a property of
_process, I use
- Use the
margin_bottom to position the
$GUI/Aligner.alignment = VBoxContainer.ALIGN_END
$GUI/Aligner.margin_bottom = -100 # height of container
$GUI/Aligner.alignment = VBoxContainer.ALIGN_BEGIN
$GUI/Aligner.margin_bottom = 0