#Giving a VBoxContainer a Background and border

22 messages · Page 1 of 1 (latest)

sullen raptor
#

Hey for npc dialogue i want to popup a small vertical menu with answer options. The amount of options will change so i want the size of the menu to change with it. It should work like in animal crossing for example. My issue is that the background will be used as a vbox item and be above the buttons whatever i try.

sullen raptor
#

Something like this but adjusting size with more text options

lilac kiln
#

I think that you can use a Panel as a parent of the VBoxContainer

sullen raptor
lilac kiln
#

Can you share an example ?

sullen raptor
lilac kiln
#

Nevermind, I'm looking into it, I thought that it resized automatically gdthinking

sullen raptor
#

Oh thanks for the effort

lilac kiln
#

PanelContainer is the one that resizes itself based on its children but Panel doesn't

sullen raptor
lilac kiln
#

Nice!
You can override the theme settings in the inspector or you can create a theme and assign it

sullen raptor
#

Oh yeah got it thanks you helped alot

lilac kiln
#

If you want to use a NinePatchRect, it will resize itself to the size of PanelContainer if it is one of its children, NinePatchRect is the node you'd use to get the Animal Crossing look where it can stretch on the sides but the corners stay the same

#

No problem gdthumbsup

sullen raptor
#

What do you mean with the corners are staying the same?

lilac kiln
#

it's called Nine Slice, it's a technique used to scale UI elements

#

it's a texture with 9 parts, the corners (1, 3, 7, 9) are never stretched, however the sides (2, 4, 6, 8) and the middle (5) can either be stretched or tiled (repeated)

sullen raptor
#

Oh so when it has texture in the middle it doesn't look weird thats cool thanks :)

lilac kiln
#

No problem, I never used it in Godot so I don't know what the workflow is but it doesn't look that complicated to figure out