HUD Text Positioning


 draw.SimpleText(velocity, "SpeedFont", 435, ScrH() - 67, Color(255,255,255)) 
 velocity = math.Round(ply:GetVelocity():Length()) 

This code is in a function hooked to HUDPaint.

The only way I can think of making the increasing number stay centered on the box is to use If statements. Anything else?

The best way would be to use the xAlign and yAlign argument for the SimpleText:http://wiki.garrysmod.com/page/draw/SimpleText


draw.SimpleText(velocity, "SpeedFont", 435, ScrH() - 67, Color(255,255,255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)

Oh thank you, hope im not ask for too much but could you explain what this does exactly, glua doesnt really say?

The first one tells it the horizontal alignment (left, center, right) and the second one tells it the vertical alignment (top, center, bottom).
By having it centered it will always stay in the same place no matter how wide or tall it becomes.