Help with Character Graphics in Loops
Author |
Message |
nmr123321
|
Posted: 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
|
|
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
Tony
![](http://wiki.compsci.ca/images/f/f4/OniTony.gif)
|
Posted: 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. |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
![](images/spacer.gif) |
GlobeTrotter
|
Posted: Tue Dec 06, 2005 5:52 pm Post subject: (No subject) |
|
|
Try putting them in the same loop. |
|
|
|
|
![](images/spacer.gif) |
DIIST
![](http://compsci.ca/v3/uploads/user_avatars/248212014b7d9f60741cd.jpg)
|
Posted: 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! |
|
|
|
|
![](images/spacer.gif) |
|
|