extends Control
@export var levelID = 1
@export var Border_Color : Color
@export var Song_Image : Texture
##OPTIONS
@onready var Song_Texture: TextureRect = $Imagepivot/PanelContainer/LevelImg
@onready var Border_Img: TextureRect = $PanelContainer/BorderImg
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
$Label.text = "Level" + str(levelID)
Song_Texture.texture = Song_Image
Border_Img.modulate = Border_Color
func _process(delta: float) -> void:
if Engine.is_editor_hint():
$Label.text = "Level" + str(levelID)
The code for my level Icon
Question
I have been trying to make customizable buttons for my game that I can easily customize the items within it. And my ideal was to make panel containers with the images inside but in a different scene I try putting it inside of a H box container but it causes all my sprites to squish and look disjointed.
Im not even sure if i should be putting it into a hbox container as I have code in the control node that allows me to select and icon with an array so I am not too sure on what to do. As I work on a big monitor and am working on godot with 1920 * 1080 and want to make sure re-scaling looks good
I followed a tutorial that was pretty amazing when it came to Inventory. They used a TextureButton with a TextureRect. Then just put everything in a GridContainer.
Control does not have a minimum size by default so it will shrink when added to a container as the container will force the minimum size of the Control.