Hey Ivan, it sounds like you have conflicting requirements. You can either have the score label and the score value maintain their distance apart which, when right justified, will cause the label to move. You can use a fixed width font that will minimize it, but as soon as the score passes another magnitude (i.e going from 99 to 100) and another digit is added, it’s going to move anyway. Or you can separate the label from the text and keep the label in a fixed location. If you expect scores to get into the 6-7 digit range, then the gap between the label and the score value can seem ugly.
My work around to this is to include leading zeros: Score: 0000104
Many games do this as the work around for this issue. To get leading zeros, you would use the string.format() API call:
g.scoreText.text = string.format( "%07d", score )
The first parameter is the formatting string. The “%” starts a format specifier. The “0” says pad with leading zeros. The “7” says make sure it’s 7 digits long. The “d” says to make it a decimal (Integer). The second parameter is the value to output.
Then you can separate the label from the score value and have two objects on the screen and the label won’t jump around on you.
Rob
