Computer Science Canada

writing variables in font

Author:  trees are uber [ Tue May 30, 2006 8:12 am ]
Post subject:  writing variables in font

how do i write variables in fonts

example: im trying to make a sprite for my score but i need to know how to write the variable for score in a font


¿?¿?¿?¿?¿?¿?¿?¿?¿?¿?¿?¿?¿?

Author:  Clayton [ Tue May 30, 2006 8:38 am ]
Post subject: 

what is the type of your variable ex. int, real, string?
if its string:
code:

var font:int:=Font.New("times new roman:12")
var myWord:string:="Hello"
Font.Draw(myWord,0,0,font,black)

code:

%for ints
var font:int:=Font.New("times new roman:12")
var myInt:int:=1200
Font.Draw(intstr(myInt),0,0,font,black)

code:

%for real
var font:int:=Font.New("times new roman:12")
var myReal:real:=3.145
Font.Draw("Pi = "+realstr(myReal),0,0,font,black)

you'll notice in the real example, i have "Pi = "+realstr(myReal) you have to concatenate strings in font commands so as not to try to pass extra paramaters Very Happy check the Turing Walkthrough for the tutorial on font commands and their uses if u are unclear on anything

Author:  trees are uber [ Tue May 30, 2006 4:14 pm ]
Post subject: 

Alright, thanks.

What i'm trying to do is make a score for my game, so that'd be in int, and then turn it into a sprite so I can have it stay on the screen the whole time.

Wink

Author:  Anonymous [ Tue May 30, 2006 4:54 pm ]
Post subject: 

tree freak

Author:  trees are uber [ Tue May 30, 2006 6:12 pm ]
Post subject: 

trees are uber though?

Author:  Cervantes [ Tue May 30, 2006 7:03 pm ]
Post subject: 

vahnx wrote:
tree freak


Not only is this a semi-flame, it's spam. Please read [The Rules].

-10 BITS.

And since it seems trees are uber has received all the help he needs on this topic, I've locked it to prevent further spam. trees are uber, please let me or another Turing mod know if you have further questions on this topic, and we will unlock it.

(And yes, trees are wonderful. Please vahnx, try living without them. Wink)


: