Drawing a variable
Author |
Message |
element4l
|
Posted: Fri Sep 28, 2007 10:56 pm Post subject: Drawing a variable |
|
|
Once again, I come back with another question.
Lets say I wanted to draw some stats in the upper right corner of the window, so the user can keep track of their health and money etc.
How would I go about doing that if they're variables? I've tried just doing code: | var font : int
font := Font.New ("serif:12")
assert font > 0
Font.Draw (health, 50, 30, font, red)
Font.Free (font) |
but it won't accept the variable since it should be inside quotations.
You guys are the best, any help would be great  |
|
|
|
|
 |
Sponsor Sponsor

|
|
 |
HeavenAgain

|
Posted: Fri Sep 28, 2007 11:11 pm Post subject: Re: Drawing a variable |
|
|
im assuming the variable, health, that you used is a int variable?
so inorder to draw font, the thing that you want to draw must be a string.
so make a ummm string variable for health
see example below
Turing: |
var font : int
var health : int := 100
var health_string : string
health = health - 10 %got hit
health_string = intstr (health )
font := Font.New ("serif:12")
assert font > 0
Font.Draw (health_string, 150, 30, font, red)
Font.Free (font )
|
the key to this is intstr, and strint, and also, Font.Draw is for string only.  |
|
|
|
|
 |
|
|