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

Username:   Password: 
 RegisterRegister   
 How do I flip the movement of this?
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
ProgrammedAlec




PostPosted: Wed Nov 12, 2008 5:50 pm   Post subject: How do I flip the movement of this?

Here is the code:
code:
View.Set ("text")
setscreen ("screen")
var row, column, colr : int
var one: int
%Created by Alec
%And Seam
        loop
        randint (one, 0, 9)
                             
        randint ( row,1, maxrow - 0)
            randint ( column, 1, maxcol)
            randint (colr, 1, maxcolor)
            put one         
            locate (row, column)
            put "0" ..
                    colourback (black)
            colour (brightgreen)
           
 
        end loop


But as you may see if you try it out, it is going upwards from the bottom.
But, what I want to do is have it move downwards from teh top... does anyone know how I can do that?
Sponsor
Sponsor
Sponsor
sponsor
OneOffDriveByPoster




PostPosted: Wed Nov 12, 2008 6:11 pm   Post subject: Re: How do I flip the movement of this?

Your question is slightly different now, yes, but please keep questions for one project to a single thread in the future.
ecookman




PostPosted: Wed Nov 12, 2008 6:22 pm   Post subject: RE:How do I flip the movement of this?

if you are trying to get it to move the opposite way

change the it to someting like this

for a: 0..50
delay (100)
locate (row, column)
put "0" ..
end for

to get it to go backwards



for b: 0..50
delay (100)
locate (-row, -column)
put "0" ..
end for



i am not sure if it works but the logic is the same
by making the row and column negitive it reverses the movement
DanielG




PostPosted: Wed Nov 12, 2008 10:20 pm   Post subject: RE:How do I flip the movement of this?

the reason it is moving upwords from the bottom is because when you print the "one" in the last row, it prints the 0 on the row below, causing the entire text to be shift up in order to allow for that printing.

I don't think there is any easy way to write this such that the text will go down; It is possible in an uneasy and definetly inefficient way to store all values and locations in an array and then whenever you want to push it up lower the row value by one.

If you want it not to move up (or down) then the best way is to simply lower the maximum column to maxcol-1 and add a .. after put one so that there is room to print the 0.
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  [ 4 Posts ]
Jump to:   


Style:  
Search: