+3 votes

i want develop mobile game only problem, different screen sizes and resolution, how to handle these in godot,
it would grt help if someone directs me,
thnks

in Engine by (15 points)

1 Answer

+3 votes

I am use:

configuration.screen_width = get_viewport_rect().size.width
configuration.screen_height = get_viewport_rect().size.height
configuration.aspect_ratio = configuration.screen_width / configuration.screen_height
if (configuration.aspect_ratio < 1) : configuration.scale_ratio = configuration.screen_height / configuration.screen_height_max
else : configuration.scale_ratio = configuration.screen_width / configuration.screen_width_max
get_node("LoadSplash").set_pos(Vector2(configuration.screen_width/2, configuration.screen_height/2))
get_node("LoadSplash").set_scale(Vector2(configuration.scale_ratio, configuration.scale_ratio))
by (208 points)

thnx VitaZheltyakov for helping me out, what about the assets should be creating for each resolution?

Your assets should be good. All you need to do is scale down the root node (which always have a viewport in it), and that will scale down your whole screen, assets and all.

For a short demonstration of this, and a shorter method, watch this tutorial:
https://www.youtube.com/watch?v=gylnwemFIZc

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.