home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / historic / v941.tgz / icon.v941src.tar / icon.v941src / ipl / gprogs / breakout.icn < prev    next >
Text File  |  2000-09-05  |  20KB  |  721 lines

  1. ############################################################################
  2. #
  3. #    File:     breakout.icn
  4. #
  5. #    Subject:  Program for Breakout game
  6. #
  7. #    Author:   Nathan J. Ranks
  8. #
  9. #    Date:     September 3, 2000
  10. #
  11. ############################################################################
  12. #
  13. #  This file is in the public domain.
  14. #
  15. ############################################################################
  16. #
  17. #  Breakout game
  18. #
  19. #  Infinite balls, Left or Right click to start or restart after losing ball
  20. #  9 levels - can select any level when not active using 1-9
  21. #  1 hit, 2 hit, 3 hit, and invincible blocks can be used for levels
  22. #
  23. ############################################################################
  24. #
  25. #  Requires:  Version 9 graphics
  26. #
  27. ############################################################################
  28. #
  29. #  Links: graphics
  30. #
  31. ############################################################################
  32.  
  33. link graphics 
  34. global sphere, blank     #sphere and blank sphere
  35. global X, Y              #coordinates of sphere
  36. global block_positions   #string of whether or not position has block
  37. global path, angle       #direction of sphere travel
  38. global wait              #pause interval used with delay()
  39. global level             #current level
  40. global hit               #sphere and block contact flag
  41. global blockclr1, blockclr2, blockclr3, invincclr
  42.  
  43. procedure main()
  44.   local e
  45.   blockclr1 := "dark blue"     #default 1 hit block color
  46.   blockclr2 := "dark red"      #default 2 hit block color
  47.   blockclr3 := "dark green"    #default 3 hit block color
  48.   invincclr := "black"         #default invincible block color
  49.  
  50.   WOpen("size=293,320") | stop("can't open window") 
  51.  
  52.   sphere := "3,g16,~0~_
  53.                    000_
  54.                    ~0~"        #black sphere
  55.  
  56.   blank  := "3,g16,~F~_
  57.                    FFF_
  58.                    ~F~"        #white sphere to erase
  59.  
  60.   level := 1                   #default start level
  61.   create_blocks()              #as the name suggests
  62.  
  63.   Fg("black")                  #default pad color
  64.   DrawLine(124,310,158,310)    #default pad position
  65.   DrawImage(140, 304, sphere)  #default sphere position
  66.   X := 140                     #default x position
  67.   Y := 304                     #default y position
  68.   path := "up_left"            #default sphere direction
  69.   angle := 60                  #default sphere angle
  70.   hit := 0
  71.  
  72. repeat {
  73.   if e := Event() then {   
  74.     if ( e === &lpress ) then {
  75.       Fg("black")
  76.       DrawLine(124,310,158,310)    #reset default
  77.       DrawImage(140, 304, sphere)  #reset default
  78.       Y := 304                     #reset default
  79.       path := "up_left"            #reset default
  80.       angle := 60                  #reset default
  81.       hit := 0
  82.  
  83.       X := &x
  84.       DrawImage(140, 304, blank)
  85.       move_pad()
  86.       move_sphere()
  87.     }
  88.     if ( e === &rpress ) then {
  89.       Fg("black")
  90.       DrawLine(124,310,158,310)    #reset default
  91.       DrawImage(140, 304, sphere)  #reset default
  92.       Y := 304                     #reset default
  93.       path := "up_right"           #reset default
  94.       angle := 60                  #reset default
  95.       hit := 0
  96.  
  97.       X := &x
  98.       DrawImage(140, 304, blank)
  99.       move_pad()
  100.       move_sphere()
  101.     }
  102.     if ( e === "1" ) then {        #change to level 1
  103.       level := 1
  104.       create_blocks()
  105.     }
  106.     if ( e === "2" ) then {        #change to level 2
  107.       level := 2
  108.       create_blocks()
  109.     }
  110.     if ( e === "3" ) then {        #change to level 3
  111.       level := 3
  112.       create_blocks()
  113.     }
  114.     if ( e === "4" ) then {        #change to level 4
  115.       level := 4
  116.       create_blocks()
  117.     }
  118.     if ( e === "5" ) then {        #change to level 5
  119.       level := 5
  120.       create_blocks()
  121.     }
  122.     if ( e === "6" ) then {        #change to level 6
  123.       level := 6
  124.       create_blocks()
  125.     }
  126.     if ( e === "7" ) then {        #change to level 7
  127.       level := 7
  128.       create_blocks()
  129.     }
  130.     if ( e === "8" ) then {        #change to level 8
  131.       level := 8
  132.       create_blocks()
  133.     }
  134.     if ( e === "9" ) then {        #change to level 9
  135.       level := 9
  136.       create_blocks()
  137.     }
  138.   }
  139. }
  140. end
  141.  
  142.  
  143.  
  144. #this keeps track of where the pad should be according
  145. #to where the mouse pointer is
  146.  
  147. procedure move_pad()
  148.   &x := image(WAttrib("pointerx"))  #get pointer position
  149.   &y := image(WAttrib("pointery"))  #get pointer position
  150.   EraseArea(0,310,293,310)          #erease old pad
  151.   Fg("black")                       #make sure color is correct
  152.   DrawLine(&x-12,310,&x+12,310)     #draw new pad
  153. return
  154. end
  155.  
  156.  
  157.  
  158. #this keeps track of sphere location and movement within the window.
  159. #hits on walls will change direction
  160. #hit on pad will change direction and possibly angle
  161.  
  162. procedure move_sphere()
  163. wait := 9
  164. while ( Y < 312 ) do {
  165.   if ( path == "up_right" ) then {
  166.     delay(wait)
  167.     move_pad()
  168.     GO_UP_RIGHT()
  169.     hit := 0
  170.     if ( X > 285 ) then {
  171.       path := "up_left"
  172.     }
  173.     if ( Y < 0 ) then {
  174.       path := "down_right"
  175.     }
  176.   }
  177.   if ( path == "up_left" ) then {
  178.     delay(wait)
  179.     move_pad()
  180.     GO_UP_LEFT()
  181.     hit := 0
  182.     if ( X < 0 ) then {
  183.       path := "up_right"
  184.     }
  185.     if ( Y < 0 ) then {
  186.       path := "down_left"
  187.     }
  188.   }
  189.   if ( path == "down_right" ) then {
  190.     delay(wait)
  191.     move_pad()
  192.     GO_DOWN_RIGHT()
  193.     hit := 0
  194.     if ( X > 285 ) then {
  195.       path := "down_left"
  196.     }
  197.     if ( (Y = 303) | (Y = 304) | (Y = 305) ) then {
  198.       if ( ((X+1) < &x+13) & ((X+1) > &x-13) ) then {
  199.         path := "up_right"
  200.         if ( (X+1) > &x-13 ) then {
  201.           angle := 30
  202.         }
  203.         if ( (X+1) > &x-6 ) then {
  204.           angle := 60
  205.         }
  206.         if ( (X+1) > &x+6 ) then {
  207.           angle := 30
  208.         }
  209.       }
  210.     }
  211.   }
  212.   if ( path == "down_left" ) then {
  213.     delay(wait)
  214.     move_pad()
  215.     GO_DOWN_LEFT()
  216.     hit := 0
  217.     if ( X < 0 ) then {
  218.       path := "down_right"
  219.     }
  220.     if ( (Y = 303) | (Y = 304) | (Y = 305) ) then {
  221.       if ( ((X+1) < &x+13) & ((X+1) > &x-13) ) then {
  222.         path := "up_left"
  223.         if ( (X+1) > &x-13 ) then {
  224.           angle := 30
  225.         }
  226.         if ( (X+1) > &x-6 ) then {
  227.           angle := 60
  228.         }
  229.         if ( (X+1) > &x+6 ) then {
  230.           angle := 30
  231.         }
  232.       }
  233.     }
  234.   }
  235. }
  236. return
  237. end
  238.  
  239.  
  240. #these next 4 procedures move the sphere
  241. #and then check for block contact
  242.  
  243. procedure GO_UP_RIGHT()
  244.   if ( angle = 30 ) then {
  245.     DrawImage(X, Y, blank)
  246.     Y := Y - 1
  247.     DrawImage(X, Y, sphere)
  248.     DrawImage(X, Y, blank)
  249.     X := X + 1
  250.     DrawImage(X, Y, sphere)
  251.     block_check()
  252.     if ( hit = 1 ) then {
  253.       fix_blocks()
  254.       return
  255.     }
  256.     DrawImage(X, Y, blank)
  257.     X := X + 1
  258.     DrawImage(X, Y, sphere)
  259.     block_check()
  260.     if ( hit = 1 ) then {
  261.       fix_blocks()
  262.       return
  263.     }
  264.   }
  265.   if ( angle = 60 ) then {
  266.     DrawImage(X, Y, blank)
  267.     Y := Y - 1
  268.     DrawImage(X, Y, sphere)
  269.     DrawImage(X, Y, blank)
  270.     X := X + 1
  271.     DrawImage(X, Y, sphere)
  272.     block_check()
  273.     if ( hit = 1 ) then {
  274.       fix_blocks()
  275.       return
  276.     }
  277.     DrawImage(X, Y, blank)
  278.     Y := Y - 1
  279.     DrawImage(X, Y, sphere)
  280.     DrawImage(X, Y, blank)
  281.     X := X + 1
  282.     DrawImage(X, Y, sphere)
  283.     block_check()
  284.     if ( hit = 1 ) then {
  285.       fix_blocks()
  286.       return
  287.     }
  288.   }
  289. return
  290. end
  291. procedure GO_UP_LEFT()
  292.   if ( angle = 30 ) then {
  293.     DrawImage(X, Y, blank)
  294.     Y := Y - 1
  295.     DrawImage(X, Y, sphere)
  296.     DrawImage(X, Y, blank)
  297.     X := X - 1
  298.     DrawImage(X, Y, sphere)
  299.     block_check()
  300.     if ( hit = 1 ) then {
  301.       fix_blocks()
  302.       return
  303.     }
  304.     DrawImage(X, Y, blank)
  305.     X := X - 1
  306.     DrawImage(X, Y, sphere)
  307.     block_check()
  308.     if ( hit = 1 ) then {
  309.       fix_blocks()
  310.       return
  311.     }
  312.   }
  313.   if ( angle = 60 ) then {
  314.     DrawImage(X, Y, blank)
  315.     Y := Y - 1
  316.     DrawImage(X, Y, sphere)
  317.     DrawImage(X, Y, blank)
  318.     X := X - 1
  319.     DrawImage(X, Y, sphere)
  320.     block_check()
  321.     if ( hit = 1 ) then {
  322.       fix_blocks()
  323.       return
  324.     }
  325.     DrawImage(X, Y, blank)
  326.     Y := Y - 1
  327.     DrawImage(X, Y, sphere)
  328.     DrawImage(X, Y, blank)
  329.     X := X - 1
  330.     DrawImage(X, Y, sphere)
  331.     block_check()
  332.     if ( hit = 1 ) then {
  333.       fix_blocks()
  334.       return
  335.     }
  336.   }
  337. return
  338. end
  339. procedure GO_DOWN_RIGHT()
  340.   if ( angle = 30 ) then {
  341.     DrawImage(X, Y, blank)
  342.     Y := Y + 1
  343.     DrawImage(X, Y, sphere)
  344.     DrawImage(X, Y, blank)
  345.     X := X + 1
  346.     DrawImage(X, Y, sphere)
  347.     block_check()
  348.     if ( hit = 1 ) then {
  349.       fix_blocks()
  350.       return
  351.     }
  352.     DrawImage(X, Y, blank)
  353.     X := X + 1
  354.     DrawImage(X, Y, sphere)
  355.     block_check()
  356.     if ( hit = 1 ) then {
  357.       fix_blocks()
  358.       return
  359.     }
  360.   }
  361.   if ( angle = 60 ) then {
  362.     DrawImage(X, Y, blank)
  363.     Y := Y + 1
  364.     DrawImage(X, Y, sphere)
  365.     DrawImage(X, Y, blank)
  366.     X := X + 1
  367.     DrawImage(X, Y, sphere)
  368.     block_check()
  369.     if ( hit = 1 ) then {
  370.       fix_blocks()
  371.       return
  372.     }
  373.     DrawImage(X, Y, blank)
  374.     Y := Y + 1
  375.     DrawImage(X, Y, sphere)
  376.     DrawImage(X, Y, blank)
  377.     X := X + 1
  378.     DrawImage(X, Y, sphere)
  379.     block_check()
  380.     if ( hit = 1 ) then {
  381.       fix_blocks()
  382.       return
  383.     }
  384.   }
  385. return
  386. end
  387. procedure GO_DOWN_LEFT()
  388.   if ( angle = 30 ) then {
  389.     DrawImage(X, Y, blank)
  390.     Y := Y + 1
  391.     DrawImage(X, Y, sphere)
  392.     DrawImage(X, Y, blank)
  393.     X := X - 1
  394.     DrawImage(X, Y, sphere)
  395.     block_check()
  396.     if ( hit = 1 ) then {
  397.       fix_blocks()
  398.       return
  399.     }
  400.     DrawImage(X, Y, blank)
  401.     X := X - 1
  402.     DrawImage(X, Y, sphere)
  403.     block_check()
  404.     if ( hit = 1 ) then {
  405.       fix_blocks()
  406.       return
  407.     }
  408.   }
  409.   if ( angle = 60 ) then {
  410.     DrawImage(X, Y, blank)
  411.     Y := Y + 1
  412.     DrawImage(X, Y, sphere)
  413.     DrawImage(X, Y, blank)
  414.     X := X - 1
  415.     DrawImage(X, Y, sphere)
  416.     block_check()
  417.     if ( hit = 1 ) then {
  418.       fix_blocks()
  419.       return
  420.     }
  421.     DrawImage(X, Y, blank)
  422.     Y := Y + 1
  423.     DrawImage(X, Y, sphere)
  424.     DrawImage(X, Y, blank)
  425.     X := X - 1
  426.     DrawImage(X, Y, sphere)
  427.     block_check()
  428.     if ( hit = 1 ) then {
  429.       fix_blocks()
  430.       return
  431.     }
  432.   }
  433. return
  434. end
  435.  
  436.  
  437.  
  438. #this draws the play fields according to what the levels
  439. #are defined as
  440.  
  441. procedure create_blocks()
  442.   local x, y, z
  443.  
  444.   if ( level > 9 ) then {
  445.     level := 1
  446.   }
  447.  
  448.   #different play fields go here
  449.   if ( level = 1 ) then { #icon-squared
  450.     block_positions := "000000000000000000000000000000000000000100000000110100110111000001010010101110101101110101000000000000000111000001110010100000101001110000011100000000000000010101110110101110101001010000011101100101100000000100000000000000000000000000"
  451.   }
  452.   if ( level = 2 ) then { #alternate rows
  453.     block_positions := "111111111111100000000000001111111111111000000000000011111111111110000000000000111111111111100000000000001111111111111000000000000011111111111110000000000000111111111111100000000000001111111111111000000000000011111111111110000000000000"
  454.   }
  455.   if ( level = 3 ) then { #alternating columns
  456.     block_positions := "101010101010110101010101011010101010101101010101010110101010101011010101010101101010101010110101010101011010101010101101010101010110101010101011010101010101101010101010110101010101011010101010101101010101010110101010101011010101010101"
  457.   }
  458.   if ( level = 4 ) then { #heart
  459.     block_positions := "000100000100000101000101000100010100010010001010001001000101000100100001000010010000100001000100000001000010000000100001000000010000010000010000001000001000000010001000000000101000000000001000000000000100000000000010000000000000000000"
  460.   }
  461.   if ( level = 5 ) then { #checker board
  462.     block_positions := "101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010"
  463.   }
  464.   if ( level = 6 ) then { #filled up
  465.     block_positions := "111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111"
  466.   }
  467.   if ( level = 7 ) then { #diamond and a half
  468.     block_positions := "000001110000000001111100000001111111000001111111110001111111111101111111111111011111111111000111111111000001111111000000011111000000000111000000000001000000000001110000000001111100000001111111000001111111110001111111111101111111111111"
  469.   }
  470.   if ( level = 8 ) then { #misc multiple hits
  471.     block_positions := "11111111111111111111111111313131313131311111111111112121212121212X3X2X3X2X3X2X111111111111111111111111113131313131313111111111111112121212121213X2X3X2X3X2X31111111111111111111111111131313131313132121212121212X3X2X3X2X3X2X1111111111111"
  472.   }
  473.   if ( level = 9 ) then { #throw-rug
  474.     block_positions := "21111111111121211111111121112111111121111121111121111111211121111211112121111212111121111211121123211211111223X322111111223X32211111211232112111211112111121211112121111211112111211111112111112111112111111121112111111111212111111111112"
  475.   }
  476.  
  477.  
  478.   z := 1
  479.   y := 10
  480.   x := 10
  481.   while not ( y = 208 ) do {
  482.     while not ( x = 283 ) do {
  483.       if ( block_positions[z] == "0" ) then {
  484.         Fg("white")
  485.         FillRectangle(x,y,20,10)
  486.       }
  487.       if ( block_positions[z] == "1" ) then {
  488.         Fg(blockclr1)
  489.         FillRectangle(x,y,20,10)
  490.       }
  491.       if ( block_positions[z] == "2" ) then {
  492.         Fg(blockclr2)
  493.         FillRectangle(x,y,20,10)
  494.       }
  495.       if ( block_positions[z] == "3" ) then {
  496.         Fg(blockclr3)
  497.         FillRectangle(x,y,20,10)
  498.       }
  499.       if ( block_positions[z] == "X" ) then {
  500.         Fg(invincclr)
  501.         FillRectangle(x,y,20,10)
  502.       }
  503.       z := z + 1
  504.       x := x + 21
  505.     }
  506.     x := 10
  507.     y := y + 11
  508.   }
  509. return
  510. end
  511.  
  512.  
  513. #this checks to see if the sphere contacts an edge
  514. #of a block, if so, it erases the block and changes
  515. #the sphere's direction accordingly
  516. #it also checks if level is finished
  517.  
  518. procedure block_check()
  519.   local x, y, z, temp, temp2
  520.   z := 1
  521.   y := 10
  522.   x := 10
  523.   while not ( y = 208 ) do {
  524.     while not ( x = 283 ) do {
  525.       if ( (((X+1)>(x-1))&((X+1)<(x+21)))&(((Y+1)>(y-1))&((Y+1)<(y+11))) ) then {
  526.         if ( block_positions[z] == "X" ) then {
  527.           hit := 1
  528.           Fg(invincclr)
  529.           FillRectangle(x,y,20,10)
  530.           if ( path == "up_right" ) then {
  531.             if ( ((X+1)=x) ) then { #side hit
  532.               path := "up_left"
  533.             }
  534.             if ( ((Y+1)=(y+10)) ) then { #bottom hit
  535.               path := "down_right"
  536.             }
  537.             if ( ((X+1)=x)&((Y+1)=(y+10)) ) then { #diagonal hit
  538.               path := "down_left"
  539.             }
  540.           }
  541.           else {
  542.             if ( path == "up_left" ) then {
  543.               if ( ((X+1)=(x+20)) ) then { #side hit
  544.                 path := "up_right"
  545.               }
  546.               if ( ((Y+1)=(y+10)) ) then { #bottom hit
  547.                 path := "down_left"
  548.               }
  549.               if ( ((X+1)=(x+20))&((Y+1)=(y+10)) ) then { #diagonal hit
  550.                 path := "down_right"
  551.               }
  552.             }
  553.             else {
  554.               if ( path == "down_left" ) then {
  555.                 if ( ((X+1)=(x+20)) ) then { #side hit
  556.                   path := "down_right"
  557.                 }
  558.                 if ( ((Y+1)=y) ) then { #top hit
  559.                   path := "up_left"
  560.                 }
  561.                 if ( ((X+1)=(x+20))&((Y+1)=y) ) then { #diagonal hit
  562.                   path := "up_right"
  563.                 }
  564.               }
  565.               else {
  566.                 if ( path == "down_right" ) then {
  567.                   if ( ((X+1)=x) ) then { #side hit
  568.                     path := "down_left"
  569.                   }
  570.                   if ( ((Y+1)=y) ) then { #top hit
  571.                     path := "up_right"
  572.                   }
  573.                   if ( ((X+1)=x)&((Y+1)=y) ) then { #diagonal hit
  574.                     path := "up_left"
  575.                   }
  576.                 }
  577.               }
  578.             }
  579.           }
  580.         }
  581.         if ( (block_positions[z] == "1") |
  582.              (block_positions[z] == "2") |
  583.              (block_positions[z] == "3") ) then {
  584.           hit := 1
  585.           if ( block_positions[z] == "1" ) then {
  586.             Fg("white")
  587.             FillRectangle(x,y,20,10)
  588.             block_positions[z] := "0"
  589.           }
  590.           if ( block_positions[z] == "2" ) then {
  591.             Fg(blockclr1)
  592.             FillRectangle(x,y,20,10)
  593.             block_positions[z] := "1"
  594.           }
  595.           if ( block_positions[z] == "3" ) then {
  596.             Fg(blockclr2)
  597.             FillRectangle(x,y,20,10)
  598.             block_positions[z] := "2"
  599.           }
  600.           if ( path == "up_right" ) then {
  601.             if ( ((X+1)=x) ) then { #side hit
  602.               path := "up_left"
  603.             }
  604.             if ( ((Y+1)=(y+10)) ) then { #bottom hit
  605.               path := "down_right"
  606.             }
  607.             if ( ((X+1)=x)&((Y+1)=(y+10)) ) then { #diagonal hit
  608.               path := "down_left"
  609.             }
  610.           }
  611.           else {
  612.             if ( path == "up_left" ) then {
  613.               if ( ((X+1)=(x+20)) ) then { #side hit
  614.                 path := "up_right"
  615.               }
  616.               if ( ((Y+1)=(y+10)) ) then { #bottom hit
  617.                 path := "down_left"
  618.               }
  619.               if ( ((X+1)=(x+20))&((Y+1)=(y+10)) ) then { #diagonal hit
  620.                 path := "down_right"
  621.               }
  622.             }
  623.             else {
  624.               if ( path == "down_left" ) then {
  625.                 if ( ((X+1)=(x+20)) ) then { #side hit
  626.                   path := "down_right"
  627.                 }
  628.                 if ( ((Y+1)=y) ) then { #top hit
  629.                   path := "up_left"
  630.                 }
  631.                 if ( ((X+1)=(x+20))&((Y+1)=y) ) then { #diagonal hit
  632.                   path := "up_right"
  633.                 }
  634.               }
  635.               else {
  636.                 if ( path == "down_right" ) then {
  637.                   if ( ((X+1)=x) ) then { #side hit
  638.                     path := "down_left"
  639.                   }
  640.                   if ( ((Y+1)=y) ) then { #top hit
  641.                     path := "up_right"
  642.                   }
  643.                   if ( ((X+1)=x)&((Y+1)=y) ) then { #diagonal hit
  644.                     path := "up_left"
  645.                   }
  646.                 }
  647.               }
  648.             }
  649.           }
  650.           #check to see if field is clear for next level
  651.           #reset sphere back to below block height
  652.           temp := 1
  653.           temp2 := 0
  654.           while ( temp < 244 ) do {
  655.             if ( (block_positions[temp] == "1") |
  656.                  (block_positions[temp] == "2") |
  657.                  (block_positions[temp] == "3") ) then {
  658.               temp2 := 1
  659.               temp := 243
  660.             }
  661.             temp := temp + 1
  662.           }
  663.           if ( temp2 = 0 ) then {
  664.             level := level + 1
  665.             create_blocks()
  666.             DrawImage(X,Y,blank)
  667.             DrawImage(140, 304, sphere)
  668.             X := 140
  669.             Y := 304
  670.             path := "up_right"
  671.           }
  672.         }
  673.       }
  674.       z := z + 1
  675.       x := x + 21
  676.     }
  677.     x := 10
  678.     y := y + 11
  679.   }
  680. return
  681. end
  682.  
  683.  
  684. #this is an extra check to make sure the blocks stay completely filled
  685. #when the sphere moves out of a block, the DrawImage(X, Y, blank)
  686. #will draw a white sphere over the old sphere, this fixes blocks
  687. #periodically by being called every block hit in the 4 move sphere procedures
  688.  
  689. procedure fix_blocks()
  690.   local x, y, z
  691.  
  692.   z := 1
  693.   y := 10
  694.   x := 10
  695.   while not ( y = 208 ) do {
  696.     while not ( x = 283 ) do {
  697.       if ( block_positions[z] == "1" ) then {
  698.         Fg(blockclr1)
  699.         FillRectangle(x,y,20,10)
  700.       }
  701.       if ( block_positions[z] == "2" ) then {
  702.         Fg(blockclr2)
  703.         FillRectangle(x,y,20,10)
  704.       }
  705.       if ( block_positions[z] == "3" ) then {
  706.         Fg(blockclr3)
  707.         FillRectangle(x,y,20,10)
  708.       }
  709.       if ( block_positions[z] == "X" ) then {
  710.         Fg(invincclr)
  711.         FillRectangle(x,y,20,10)
  712.       }
  713.       z := z + 1
  714.       x := x + 21
  715.     }
  716.     x := 10
  717.     y := y + 11
  718.   }
  719. return
  720. end
  721.