How to change a label anchor point ?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By dennisb
:warning: Old Version Published before Godot 3 was released.

So I have this label that shows the score, and I want to tween its scale property whenever the player got a score. Well the tween works but the anchor point of the scale stays on the upper left side of the label. I’ve tried to change the anchor point to center but nothing works. Do I have to set the anchor point by script ?

I’m using version 2.14 if you wonder

:bust_in_silhouette: Reply From: LainVohnDyrec

im not sure what you want to do, if you want to set
the anchor points you can set it in the Label Settings or
code using set_anchor() function for script.

but judging in your post, you might also want to try
the font alignment, set it to center in the Label info
or you may use set_align() and set_valign() to make the text
centered in the anchor points.

What I wanted to do was to scale the text from the center not the upper left corner and I already did set the anchor to the center but whenever I scale the label still scales from the upper left corner. Haven’t tried it with code yet though, but thanks for the suggestion.

dennisb | 2017-09-11 12:49

:bust_in_silhouette: Reply From: volzhs

Proper anchor handling of GUI components is implemented on 3.0 (alpha), but not 2.x
I had the same issue and fixed by adding another Control node as parent.
And using it as an anchor point and scaling it.

Thank you so much for this reply, I spent hours trying to figure out what I did wrong.

dennisb | 2017-09-11 12:49