Computer Science Canada Font.Draw with variables!? |
Author: | Unicornzrcool [ Sun Jan 11, 2009 10:43 pm ] | ||||
Post subject: | Font.Draw with variables!? | ||||
Hi, I'm rather new at Turing and I was just wondering if it is possible to put a variable within the font.draw, and if it isnt, I would also like to know if there is any way of outputting a variable in a specified font and size.
I would like the variable name1 to come right after the text. If this is possible I would greatly appreciate it if you could teach me how. =] Mod Edit: Remember to use syntax tags! Thanks
|
Author: | Laplace's Demon [ Sun Jan 11, 2009 10:47 pm ] |
Post subject: | Re: Font.Draw with variables!? |
Yes, you can use a variable, you can even use a variable that is not in "string" form, you can also use multiple variables and a mixture of variables and strings using the + sign. ie: Draw.Text (intstr (health) + " /160", 175, 321, font1, black) In your case, just alter the line of code to look like: Font.Draw ("Welcome " + name1, 10, 10, font1, black) |
Author: | andrew. [ Mon Jan 12, 2009 4:19 pm ] | ||||
Post subject: | RE:Font.Draw with variables!? | ||||
Try using the "+" sign to concatenate different strings and variables. Concatenation is when you join two strings together. You can use this in put statements like:
Or, you can use this in your case with:
|
Author: | Unicornzrcool [ Mon Jan 12, 2009 4:47 pm ] |
Post subject: | Re: Font.Draw with variables!? |
Thank you so much! |