This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

Is it possible to make 4 circles in a row in landscape mode and for portrait mode, two circles move above and 2 circles move below. I need urgent guidance.

Godot version Latest standard version
in Engine by (12 points)

1 Answer

0 votes

Godot haven't float containers, but you can use GridContainer and dynamicly change it's colums number through the script when the screen rotates. Like this:

func _ready():
    get_tree().root.connect("size_changed", self, "_on_viewport_size_changed")

func _on_viewport_size_changed():
    if get_tree().root.get_size().x > get_tree().root.get_size().y:
        colums = 4
        colums = 2
by (654 points)

To add to USBashka's answer - there is also AutoGridContainer in the AssetLib for more generic solution, although I haven't used it.

You can also use OS.screen_orientation in the if statement

Yeah, you're right. And it's also FlowContainers was added in the 3.5 version RC8 (still recommend using stable)

enter image description here

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 Frequently asked questions and 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 [email protected] with your username.