0 votes

I'm trying to create dialogue boxes for my current project, and I've been using a combination of a Panel to act as a base, a RichTextLabel for the words, and a Polygon2D covering the panel as a sort of sprite for the dialogue box, all connected together so that they move as one. (I might later use an actual sprite for the image, but for the moment a colored block is all I need as the stand-in.) I've been having success with the code associated with the actual dialogue for my dialogue box, but I can't figure out how to move the dialogue box around with the camera. So, at the moment I can place the dialogue box at a fixed place on the map, but I can't figure out how to make the panel fill a specific portion of the current viewport. I drew a terrible picture in Paint to illustrate what I mean.

How I want the dialogue box to appear on screen.

I will happily accept suggestions on how to do this in the code, in the settings of the node, even alternate methods to the method I am currently doing this. Thank you in advance, I really appreciate the Godot community.

in Engine by (28 points)

You should probably get rid of the Polygon2D if you don't need it specifically for some reason. It will make your life a lot simpler if you have to resize the dialog box.

If you want a solid color or even a texture later, the panel is enough.

Select the panel node and scroll down in the inspector to Custom Styles. Add a StyleBoxFlat or StyleBoxTexture to the option named Panel.

You're completely right! Thanks.

1 Answer

+1 vote
Best answer

I'm not sure if this is what you're looking for, but if you add the dialog box as a child of a CanvasLayer, it will always stay in the same place on screen.

by (462 points)
selected by

That's definitely the way to do it, thanks.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.