Computer Science Canada

Using Variables with Font.Draw

Author:  seawad_ [ Tue Oct 21, 2014 7:48 pm ]
Post subject:  Using Variables with Font.Draw

I can't figure out how to make variables work with Font.New
Please heal or post a code.

var font := Font.New ("Times New Roman:30")
var ps : int

Font.Draw (ps,x,y,font,colour)

I want to make it so it displays ps (player score)

Thank you

Author:  Zren [ Tue Oct 21, 2014 7:57 pm ]
Post subject:  RE:Using Variables with Font.Draw

The first parameter in the procedure Font.Draw is of the string type. You can convert an integer to a string by using the intstr function.

Turing:

var number : int := 0

% Example of converting an integer to a string and storing it as a variable.
var text : string := "1"
text := intstr(number)

% Example of converting an integer to a string and combining it with another string before rendering it using a font & color.
Font.Draw("Score: " + intstr(number), x, y, fontId, colorId)


: