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

Username:   Password: 
 RegisterRegister   
 Help with Character Graphics in Loops
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
nmr123321




PostPosted: Tue Dec 06, 2005 5:21 pm   Post subject: Help with Character Graphics in Loops

If you run the program you'll see that the bus is moving left to right. I want to run the car right to left from row 10 but its not working. I tried putting both of these loops in a loop but its not working


code:

var row := 2
var column := 1

loop
    locate (row - 1, 1)
    put repeat ("=", 80)
    %___________________________________________
    locate (row, column)
    put "  ,-----.,-----.,---.\\\\       "
    locate (row + 1, column)
    put "  ||     ||     ||    \\\\      "
    locate (row + 2, column)
    put " |`-----'|-----||-----\\\\`----."
    locate (row + 3, column)
    put "  [       |    -||-   _|    (|  "
    locate (row + 4, column)
    put "  [  ,--. |_____||___/.--.   |  "
    locate (row + 5, column)
    put "  =-(( `))-----------(( `))-==  "
    %_________________________________________________
    locate (row + 6, 1)
    put repeat ("=", 80)
    delay (500)
    %______________________________________________
    locate (row, column)
    put "                                "
    locate (row + 1, column)
    put "                                "
    locate (row + 2, column)
    put "                                "
    locate (row + 3, column)
    put "                                "
    locate (row + 4, column)
    put "                                "
    locate (row + 5, column)
    put "                                "
    %___________________________________________
    if column = 50 then
        column := 1

    end if
    column := column + 1

    %_________________________________________________
end loop

loop
var row1 := 10
var column1 := 80

locate (row1, column1)
put "___//__][__\\\\___\\"
locate (row1 + 1, column1)
put "(o _ |  -|   _   o| "
locate (row1 + 2, column1)
put " `(_)-------(_)---' "


if column1 = 60 then
    column1 := 80
end if
column1 := column1 -1
end loop
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Tue Dec 06, 2005 5:39 pm   Post subject: (No subject)

well you are never exiting your first loop, so it will continue on forever.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
GlobeTrotter




PostPosted: Tue Dec 06, 2005 5:52 pm   Post subject: (No subject)

Try putting them in the same loop.
DIIST




PostPosted: Tue Dec 06, 2005 7:19 pm   Post subject: (No subject)

Try A Counted LOOP! Like the bellow.
code:

var row := 2
for column:1..maxcol
    locate (row - 1, 1)
    put repeat ("=", 80)
    %___________________________________________
    locate (row, column)
    put "  ,-----.,-----.,---.\\\\       "
    locate (row + 1, column)
    put "  ||     ||     ||    \\\\      "
    locate (row + 2, column)
    put " |`-----'|-----||-----\\\\`----."
    locate (row + 3, column)
    put "  [       |    -||-   _|    (|  "
    locate (row + 4, column)
    put "  [  ,--. |_____||___/.--.   |  "
    locate (row + 5, column)
    put "  =-(( `))-----------(( `))-==  "
    %_________________________________________________
    locate (row + 6, 1)
    put repeat ("=", 80)
    delay (100)
    %______________________________________________
    locate (row, column)
    put "                                "
    locate (row + 1, column)
    put "                                "
    locate (row + 2, column)
    put "                                "
    locate (row + 3, column)
    put "                                "
    locate (row + 4, column)
    put "                                "
    locate (row + 5, column)
    put "                                "
     

    %_________________________________________________
end for
Thats pretty cool thought, that you doing animation with characters!
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: