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

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




PostPosted: Sun May 20, 2012 6:28 pm   Post subject: Turing

What is it you are trying to achieve?
<Replace all the <> with your answers/code and remove the <>>


What is the problem you are having?

Can someone tell me what's wrong with my program? like what does it leave a red line behind the word?
var font : int
font := Font.New ("serif:36")

delay (100)
for x : 0 .. maxx - 450

Draw.Text ("HI", 50 + x, 30 + x, font, red)

end for



Describe what you have tried to solve this problem
<Answer Here>


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

Turing:


<Add your code here>



Please specify what version of Turing you are using
<Answer Here>
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Sun May 20, 2012 7:32 pm   Post subject: RE:Turing

would it help you figure out what that "line" is, if you use
code:

for x : 0 .. maxx - 450 by 5

instead?
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
crossley7




PostPosted: Sun May 20, 2012 8:38 pm   Post subject: RE:Turing

look at what your loop is doing. every time it goes through the loop it draws your text 1 pixel further over.

possibly since the program is so short, out a delay(5) in to see what happens every time it goes through the for loop at a pace that your mind can register.
turinggirl




PostPosted: Sun May 20, 2012 10:05 pm   Post subject: Re: Turing

I have tried using cls but i don't know why it doesn't work
crossley7




PostPosted: Sun May 20, 2012 10:41 pm   Post subject: RE:Turing

what are you trying to do? Just get rid of writing it many times? That line is actually the text written on top of itself many times if you want to know what your problem really is. Now you should be able to come up with a few ideas on how to proceed to fix your problem
turinggirl




PostPosted: Sun May 20, 2012 10:43 pm   Post subject: Re: Turing

I want to move the text diagonally across the screen :S
evildaddy911




PostPosted: Mon May 21, 2012 12:21 pm   Post subject: RE:Turing

add in the "by" that tony mentioned, put a delay (10 would work) and a cls right before the "end for"

"by X": will skip every X numbers, moving the text quicker.
"delay (X)" will make is so the program doesn't finish seemingly instantaneously
cls will remove the last "HI", thereby removing any red lines
Raknarg




PostPosted: Mon May 21, 2012 2:59 pm   Post subject: RE:Turing

a better explanation:

in a for loop, by will skip a number of iterations based on the number next to the by:

for i : 1 .. 5 by 2

In this case, the loop will instead of going 1, 2, 3, 4, 5, will go 1 ,3, 5.

delay (x) will pause the program for x milliseconds

cls clears everything from the screen (text or graphics)
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Mon May 21, 2012 3:13 pm   Post subject: RE:Turing

The reason I was suggesting the use of "by" is to make it really obvious that the trailing colour is from previously drawn text, not some arbitrary "line".
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  [ 9 Posts ]
Jump to:   


Style:  
Search: