0 votes

Hey,

I want to do something like this

And this is what I have

How can i make the icons fit the screen and not overflow?

Thanks :)

Godot version 3.3.2
in Engine by (12 points)

1 Answer

0 votes

I do not know if this is exactly that you want but I tell you how:
-select the HBoxContainer and in the inspector open the transform tab
-check the x and the y size
-attach an script to the HBoxContainer
-write the following code:

extends HBoxContainer


onready var first = $CharacterIconPreview1
onready var second = $CharacterIconPreview2
onready var third = $CharacterIconPreview3
onready var four = $CharacterIconPreview4


var requested_size = Vector2(5, 5) #Input here the values that you previously got.


func _ready():
first.set_size(requested_size)
second.set_size(requested_size)
third.set_size(requested_size)
four.set_size(requested_size)

Warning with the identations

I hope this will be useful for you!!

by (115 points)

I do not have a transform tab, do u mean Rect Position?

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.