Hi, I'm new to using Godot technology. I'm studying making a prototype and I have a problem regarding the alignment of a Label.
Could anyone help with this question and tell me where I'm going wrong?
Thank you very much for your attention and I'm excited to use Godot.
extends Node2D
var block_texture = preload("res://block.svg") # Substitua pelo caminho da sua textura de bloco
var block_scores = [10, 20, 30, 40, 50, 60] # Pontuação para cada bloco
var block_distance = 50 # Distância entre os blocos
func _ready():
for i in range(block_scores.size()):
var block = Sprite2D.new()
block.texture = block_texture
block.position = Vector2(get_viewport().size.x / 2, get_viewport().size.y - i * (block_texture.get_height() + block_distance))
add_child(block)
var score_label = Label.new()
score_label.text = str(block_scores[i])
score_label.align = Label.ALIGN_CENTER
score_label.valign = Label.VALIGN_CENTER
score_label.rect_min_size = block_texture.get_size()
block.add_child(score_label)