method
Screen.draw_number
Screen.draw_number(x, y, value, color, scale)
Draws an integer as digits using the built-in font, without first turning it into a string — so it never allocates and is safe to call every frame for constantly-changing values. Use it for scores, timers, frame counts, health totals, and any HUD number, while reserving Screen.draw_text for fixed labels. It takes the same top-left position, color, and integer scale as draw_text. Negative values are drawn with a leading minus sign.
Parameters
xthe left edge of the first digit, in pixelsythe top edge of the number, in pixelsvaluethe integer to drawcolorthe digit color, e.g. a Color.* name or a 0xRRGGBB literalscaleinteger size multiplier (1 = native size)Example
program ScoreHud {
var score: int = 0
handler EarnPoints phase Update {
score = score + 1
}
handler DrawWorld phase Render {
Screen.clear(Color.MidnightBlue)
Screen.draw_text(x: 6, y: 4, text: "SCORE", color: Color.White, scale: 1)
Screen.draw_number(x: 52, y: 4, value: score, color: Color.Gold, scale: 1)
Screen.show()
}
}