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

Username:   Password: 
 RegisterRegister   
 Need help putting random integers in fixed locations
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
GalacticVenus




PostPosted: Sat Dec 05, 2009 7:23 pm   Post subject: Need help putting random integers in fixed locations

What is it you are trying to achieve?
I'm making a turn-based RPG and would like to put the damage on the pictures of the Hero and the Enemy when it's dealt.
The damage is a random integer (10 to 22) plus the Hero's level squared plus (Power * 3 - 1) divided by 2.


What is the problem you are having?
I don't know how-- or even if it is possible to place a random number on a location on-screen.


Describe what you have tried to solve this problem
Mucking around with the command (Draw.Text, Draw.Num, Draw.Number, Number.Draw)
Looking in the manual thingy (And since it's me doing it, it's not very effective)
Swearing
Asking the computer nicely



Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)


Turing:


var HeroAttack : int
var text : int
text := Font.New ("impact:10")

HeroAttack := Rand.Int (10, 22) + level ** 2 + (Power * 3 - 1) div 2


Draw.Text (HeroAttack, 150, 150, text, red)



Please specify what version of Turing you are using
4.1.1
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Sat Dec 05, 2009 7:32 pm   Post subject: Re: Need help putting random integers in fixed locations

GalacticVenus @ Sat Dec 05, 2009 7:23 pm wrote:

I don't know how-- or even if it is possible to place a random number on a location on-screen.

Well where did you get the idea to display the damage dealt in this way? Laughing

If you look at the error message closely, it will tell you that Font.Draw / Draw.Text expects a string to draw. So instead of number 12, you need to a word "12" to draw. You can convert from int to string with a use of intstr
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
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  [ 2 Posts ]
Jump to:   


Style:  
Search: