Topic was automatically imported from the old Question2Answer platform.
Asked By
rogerdv
In my game I have a camera that follows the player (lets say, like Hollow Knight) and I havent found a way to keep the UI in the screen. I thought that I should make it children of the camera, but anyway the UI elemnts sometimes move outside view. Whats the correct way to manage the UI in a 2D game?
I had this issue on the weekend - when my player would run off the site of the screen - he would run away from the Health bar. I stuck the whole UI inside a Canvas Layer and now the UI stays in the view port.
Yes, that solved the problem! But now how can I make the lements resize with the screen? I dont see the green thingies in the corners.of UI widgets.
rogerdv | 2020-01-28 20:35
I think I know what you mean, and I’ll try to get your some reference on that.
mattkw80 | 2020-01-28 20:39
Which elements (nodes) are you using?
mattkw80 | 2020-01-28 20:54
I plan to use several images, labels, buttons, and recently fixed the joystick, which is composed by an sprite and a child TouchScreenButton.
rogerdv | 2020-01-28 21:32
Hey Sorry Roger, I’m trying to understand the resize the screen part… is your sceen size changing (zooming) in play, or do you mean - while making the UI, you are having trouble resizing the UI controls?
mattkw80 | 2020-01-28 22:10
I want to be ready for different resolutions, this is a game for cell phones, but I want to be ready for PCs with different resolutions too.
I did that but now the UI is just stuck to the background despite being a child of the player and the canvas node. I already enabled the viewport follow. Maybe its broken in godot 4.