Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Converting int to string
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
TuringDan




PostPosted: Sun Apr 13, 2008 1:57 pm   Post subject: Converting int to string

I want to convert an int variable into a string in order to display it using Draw.Text instead of put (to avoid the nasty background).

the int variable is health, it is constantly changing, and I want to display the number on my health bar.

Any help would be much appreciated.

also, this is my first post on these boards.
Sponsor
Sponsor
Sponsor
sponsor
[Gandalf]




PostPosted: Sun Apr 13, 2008 2:08 pm   Post subject: RE:Converting int to string

It's been a while since I've done Turing, but it goes something like this:
code:
Draw.Text("Health: " + intstr(health), x, y, colour)
TuringDan




PostPosted: Sun Apr 13, 2008 2:11 pm   Post subject: Re: Converting int to string

That worked! thanks a million.
[Gandalf]




PostPosted: Sun Apr 13, 2008 2:13 pm   Post subject: RE:Converting int to string

No problem, and welcome to CompSci.ca, enjoy your stay! Smile
TuringDan




PostPosted: Sun Apr 13, 2008 2:16 pm   Post subject: Re: Converting int to string

Good to be here. I did a bit of turing in grade 9 and did not start again until this year (Im in grade 11)

I'm just teaching myself right now, and preparing for the grade 12 comp. info sciences course. I would have taken it this year but mandatory credits got in the way.

The code I wrote with your advice looks like this:

code:
Draw.Text (intstr(health)+" /160", 175, 321, font1, black)
Draw.Text (intstr(enemy1)+" /160", 505, 321, font1, black)
Draw.Text (intstr(enemy1mana)+" /160", 505, 306, font1, black)
Nick




PostPosted: Sun Apr 13, 2008 2:34 pm   Post subject: RE:Converting int to string

looks good, but look up arrays in the Turing Walkthrough
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 6 Posts ]
Jump to:   


Style:  
Search: