home *** CD-ROM | disk | FTP | other *** search
/ Windows CE - The Ultimate Companion / ROMMAN_CE.iso / Files / Programming / Basice / Sabotage / SABOTAGE.BAS next >
BASIC Source File  |  1997-11-14  |  17KB  |  833 lines

  1. ! Sabotage!
  2. ! A BasiCE version of an AppleII clasic by
  3. ! Ricardo A. Barijan
  4. ! Version 1.1
  5. ! Last update: November 13, 1997
  6.  
  7. call clrscr    ! To be ensure that the screen is blank
  8. wait 0.2
  9. call clrscr
  10. wait 0.2
  11. call clrscr
  12. print "Q"+chr$(35);    ! Set color to 3
  13.  
  14. ! Variables for each man (up to 6)
  15. dim mx%[6]    ! x
  16. dim my%[6]    ! y
  17. dim ms%[6]    ! status
  18.  
  19. dim gr%[46]    ! Men at ground (landed)
  20. dim jump%[8]    ! Jump tables (values of y)
  21.  
  22. call set_table
  23. hiscore%=0
  24. call read_hi
  25.  
  26. if hiscore%<250 then
  27.     hiscore%=250    ! Initial Hiscore
  28. endif
  29.  
  30. !********** Possible values of ms%[n] **********!
  31. ! 0 dead (or landed)
  32. ! 1 death anim at ground
  33. ! 2 death anim at ground
  34. ! 3 faling
  35. ! 4 erasing death anim at ground
  36. ! 5 gliding
  37. ! 6 erasing death
  38. ! 7 death anim
  39.  
  40. call start    ! Title screen !
  41. call init
  42. quit%=0
  43. demo%=1
  44.  
  45. tx%=74
  46. ty%=44
  47.  
  48. call draw_base
  49. call score
  50. call hiscore
  51.  
  52. !MAIN LOOP
  53. loop
  54.     k$=key$
  55.     k%=asc%(k$,1)
  56.         !if(k%<>0) then   ! Test !
  57.             !call curpos(15,5)
  58.             !print " ";k$;"  ";k%;"  ";shot%;"  "
  59.         !endif
  60.  
  61. !*********
  62. !call test1  ! Development routines
  63. !call test2
  64. !if((k%=32) and (cur_man%>1)) then
  65. !ms%[cur_man%-1]=3
  66. !endif
  67. !*********
  68.  
  69.     if(k%=8) then
  70.         if(demo%) then quit%=1 endif
  71.         call init
  72.         call clrscr
  73.         call hiscore
  74.         demo%=1
  75.         k%=0
  76.     endif
  77.  
  78. if(demo%) then
  79.     call demo
  80. endif
  81.  
  82.     if((k%<56) and (k%>48) and (shot%=0)) then
  83.         shot%=k%-48
  84.         call shot
  85.     else
  86.         if(shot%>0) then
  87.             print "Q"+chr$(32);
  88.             call shot
  89.             print "Q"+chr$(35);
  90.             shot%=0
  91.         endif
  92.     endif
  93.  
  94. if k%=112 then
  95.     loop
  96.         call curpos(34,7)
  97.         print" P A U S E ";
  98.         wait 0.1
  99.         k$=key$
  100.         while len%(k$)=0
  101.     endloop
  102.     call curpos(34,7)
  103.     print"           ";
  104. endif
  105.     
  106. call men
  107. call move1
  108. call draw_base
  109.  
  110. wait 0.01
  111.  
  112. while quit%=0
  113. endloop
  114. !END OF MAIN LOOP
  115.  
  116.  
  117. call clrscr
  118. call curpos(0,2)
  119. print"Thanks for playing Sabotage."
  120. print"Check for new games at:"
  121. print"http://www.geocities.com/SiliconValley/Park/7794"
  122. print"email: barijan@usa.net
  123. print""
  124. !END OF THE PROGRAM
  125.  
  126. !----- PROCEDURES -------
  127.  
  128. procedure shot
  129.     if(shot%=1) then
  130.         call line(1,148,240,148)
  131.         return
  132.     endif
  133.     if(shot%=2) then
  134.         call line(1,30,240,148)
  135.         return
  136.     endif
  137.     if(shot%=3) then
  138.         call line(130,1,240,148)
  139.         return
  140.     endif
  141.     if(shot%=4) then
  142.         call line(240,1,240,148)
  143.         return
  144.     endif
  145.     if(shot%=5) then
  146.         call line(350,1,240,148)
  147.         return
  148.     endif
  149.     if(shot%=6) then
  150.         call line(479,30,240,148)
  151.         return
  152.     endif
  153.     if(shot%=7) then
  154.         call line(479,148,240,148)
  155.         return
  156.     endif
  157. endproc
  158.  
  159. procedure draw_base
  160.   ! Draw men in the ground !
  161.     loop for i%=1 to 46
  162.         if(gr%[i%]) then
  163.             x%=i%*10-6
  164.             call fillrect(x%+5,155,x%+8,158)
  165.             call fillrect(x%+5,160,x%+8,165)
  166.             call line(x%+3,159,x%+10,159)
  167.         endif
  168.     endloop
  169.   ! Draw cannon base and ground !
  170.     call line(5,165,475,165)
  171.     call fillrect(230,155,250,165)
  172.     call fillrect(235,150,245,155)
  173.     call line(239,149,241,149)
  174. endproc
  175.  
  176. procedure move1        ! Airplane !
  177.     p1x%=p1x%-10
  178.     if(p1x%<0) then
  179.         p1x%=600
  180.         print "Q"+chr$(32);
  181.         call fillrect(0,8,23,17)
  182.         print "Q"+chr$(35);
  183.         if(explode%) then 
  184.             call destruct
  185.             endproc
  186.         endif
  187.         if(drop%=0) then
  188.             c%=0
  189.             loop for i%=1 to 6
  190.                 c%=c%+ms%[i%]
  191.             endloop
  192.             if c%=0 then explode%=1
  193.             endif
  194.         endif
  195.         wave%=wave%+1
  196.         if(mod%(wave%,10)=0) then level%=level%+1 endif
  197.         call score
  198.     endif
  199.  
  200.     if(p1x%>455) then
  201.         call explo
  202.         wait 0.08
  203.         return
  204.     endif
  205.     call init_man
  206.     print "Q"+chr$(32);
  207.     call fillrect(p1x%+10,8,p1x%+33,17)
  208.     print "Q"+chr$(35);
  209.     call fillrect(p1x%,11,p1x%+20,14)
  210.     call line(p1x%+4,10,p1x%+20,10)
  211.     call fillrect(p1x%+21,8,p1x%+23,15)
  212.     call line(p1x%+20,9,p1x%+20,14)
  213.     call line(p1x%+10,9,p1x%+13,9)
  214.     call line(p1x%+10,14,p1x%+14,14)
  215.     call line(p1x%+11,15,p1x%+15,15)
  216.     call line(p1x%+12,16,p1x%+16,16)
  217.  
  218.     if(shot%) then
  219.         if((shot%=5) and (p1x%<350) and (p1x%>310)) then
  220.             score%=score%+20
  221.             ex%=p1x%/6-2
  222.             p1x%=650
  223.         endif
  224.         if((shot%=3) and (p1x%<150) and (p1x%>110)) then
  225.             score%=score%+10
  226.             ex%=p1x%/6-2
  227.             p1x%=650
  228.         endif
  229.         if((shot%=4) and (p1x%<240) and (p1x%>210)) then
  230.             score%=score%+15
  231.             ex%=p1x%/6-2
  232.             p1x%=650
  233.         endif
  234.     !call score
  235.     endif
  236. endproc
  237.  
  238. procedure init_man
  239.     if((ms%[cur_man%]) or ((p1x%>200) and (p1x%<260)) or (timer%>0) or (drop%=0)) then
  240.         timer%=timer%-1
  241.         return
  242.     endif
  243. ! Pseudo random timer based on game level and wave !
  244.     timer%=(22-level%)-p1x%/30+10/wave%
  245.     !call curpos(5,0)
  246.     !print timer%;
  247.     mx%[cur_man%]=p1x%+4
  248.     my%[cur_man%]=16
  249.     ms%[cur_man%]=5
  250.     cur_man%=cur_man%+1
  251.     if(cur_man%=7) then cur_man%=1 endif
  252. endproc
  253.  
  254. procedure hit
  255.     ms%[man%]=7
  256.        print "Q"+chr$(32);
  257.     call fillrect(x%,y%,x%+13,y%+17)
  258.     print "Q"+chr$(35);
  259.     call line(x%,y%+2,x%+4,y%+6)
  260.     call line(x%+6,y%+2,x%+6,y%+6)
  261.     call line(x%+12,y%+2,x%+8,y%+6)
  262.     call line(x%,y%+8,x%+4,y%+8)
  263.     call line(x%+9,y%+8,x%+13,y%+8)
  264.     call line(x%,y%+14,x%+4,y%+10)
  265.     call line(x%+6,y%+11,x%+6,y%+15)
  266.     call line(x%+9,y%+11,x%+13,y%+15)
  267. endproc
  268.  
  269. procedure men
  270.   loop for man%=1 to 6
  271.    if(ms%[man%]) then
  272.     x%=mx%[man%]
  273.     y%=my%[man%]
  274.     s%=ms%[man%]
  275.  
  276.        print "Q"+chr$(32);
  277.     call fillrect(x%,y%,x%+13,y%+17)
  278.     print "Q"+chr$(35);
  279.  
  280.     if(s%=7) then
  281.         ms%[man%]=0
  282.         score%=score%+5
  283.         call score
  284.     endif
  285.  
  286.     if(s%=5) then
  287.         y%=y%+4
  288.         my%[man%]=y%
  289.         call fillrect(x%+5,y%+7,x%+8,y%+10)
  290.         call fillrect(x%+5,y%+12,x%+8,y%+17)
  291.         call line(x%+3,y%+11,x%+10,y%+11)
  292.         call line(x%+3,y%,x%+10,y%)
  293.         call line(x%,y%+3,x%+3,y%)
  294.         call line(x%+10,y%+1,x%+13,y%+4)
  295.         call line(x%+1,y%+4,x%+4,y%+7)
  296.         call line(x%+9,y%+6,x%+12,y%+3)
  297.         call line(x%+6,y%+1,x%+6,y%+6)
  298.         if(shot%) then
  299.          if((y%=136) or (y%=140)) then
  300.           if((shot%=1) and (x%<230)) then call hit
  301.           endif
  302.           if((shot%=7) and (x%>230)) then call hit
  303.           endif
  304.          endif
  305.          if(shot%=2) then
  306.           if (abs(y%-(x%/2+29))<4) then ms%[man%]=3 endif
  307.           if (abs(y%-(x%/2+21))<6) then call hit endif
  308.          endif
  309.          if(shot%=6) then
  310.           if (abs(y%+(x%/2-263))<4) then ms%[man%]=3 endif
  311.           if (abs(y%+(x%/2-255))<6) then call hit endif
  312.          endif
  313.          if(shot%=3) then
  314.           if (abs(y%-(x%*4/3-170))<12) then ms%[man%]=3 endif
  315.           if (abs(y%-(x%*4/3-176))<6) then call hit endif
  316.          endif
  317.          if(shot%=5) then
  318.           if (abs(y%+(x%*4/3-452))<12) then ms%[man%]=3 endif
  319.           if (abs(y%+(x%*4/3-446))<6) then call hit endif
  320.          endif
  321.         endif
  322.         if y%=148 then
  323.             ms%[man%]=0
  324.             print "Q"+chr$(32);
  325.             call fillrect(x%,y%,x%+13,y%+7)
  326.             print "Q"+chr$(35);
  327.             if(gr%[(x%+6)/10]=0) then
  328.                 gr%[(x%+6)/10]=1
  329.                 if(x%<220) then landl%=landl%+1
  330.                 else landr%=landr%+1
  331.                 endif
  332.                 if((landr%>2) or (landl%>2)) then
  333.                     drop%=0
  334.                     c%=0
  335.                     loop for i%=1 to 6
  336.                         c%=c%+ms%[i%]
  337.                     endloop
  338.                     if c%=0 then explode%=1
  339.                     endif
  340.                 endif
  341.             endif
  342.         endif
  343.     endif
  344.  
  345.     if(s%=4) then
  346.         print "Q"+chr$(32);
  347.         call fillrect(x%+1,y%+7,x%+11,y%+11)
  348.         print "Q"+chr$(35);
  349.         call plot(x%+4,y%+20)
  350.         call plot(x%+9,y%+19)
  351.         ms%[man%]=0
  352.     endif
  353.  
  354.     if(s%=1) then
  355.         print "Q"+chr$(32);
  356.         call fillrect(x%+3,y%+9,x%+11,y%+16)
  357.         print "Q"+chr$(35);
  358.         call plot(x%+1,y%+9)
  359.         call plot(x%+6,y%+7)
  360.         call plot(x%+10,y%+10)
  361.         call line(x%+3,y%+19,x%+7,y%+19)
  362.         score%=score%+15
  363.         call score
  364.         ms%[man%]=4
  365.     endif
  366.  
  367.     if(s%=2) then
  368.         print "Q"+chr$(32);
  369.         call fillrect(x%+3,y%+7,x%+10,y%+17)
  370.         print "Q"+chr$(35);
  371.         call line(x%+3,y%+12,x%+6,y%+15)
  372.         call line(x%+6,y%+10,x%+6,y%+13)
  373.         call line(x%+8,y%+14,x%+10,y%+11)
  374.         call line(x%+1,y%+18,x%+11,y%+18)
  375.         if(gr%[(x%+6)/10]) then
  376.             gr%[(x%+6)/10]=0
  377.             score%=score%+20
  378.             if(x%<220) then landl%=landl%-1
  379.             else landr%=landr%-1
  380.             endif
  381.             if((landr%<3) and (landl%<3)) then
  382.                 drop%=1
  383.             endif
  384.         endif
  385.         ms%[man%]=1
  386.     endif
  387.  
  388.     if(s%=3) then
  389.         y%=y%+8
  390.         my%[man%]=y%
  391.         call fillrect(x%+5,y%+7,x%+8,y%+10)
  392.         call fillrect(x%+5,y%+12,x%+8,y%+17)
  393.         call line(x%+3,y%+11,x%+10,y%+11)
  394.         if ((y%=144) or (y%=148)) then
  395.             call line(x%+3,157,x%+6,160)
  396.             call line(x%+6,160,x%+10,156)
  397.             ms%[man%]=2
  398.             my%[man%]=148
  399.         endif
  400.     endif
  401.  
  402.    else
  403.     print"";   !  Delay lines !
  404.     print"";
  405.     print"";
  406.    endif
  407.   endloop
  408. endproc
  409.  
  410. procedure score
  411.     call curpos(2,17)
  412.     print"SCORE:"score%;
  413.     call curpos (36,17)
  414.     print"LEVEL:"1+level%;
  415.     call curpos(69,17)
  416.     print"WAVE:"wave%;
  417. endproc
  418.  
  419. procedure hiscore
  420.     call curpos(30,0)
  421.     print"HI-SCORE: "hiscore%;
  422. endproc
  423. procedure explo
  424. if (p1x%<610) then return endif
  425. call curpos(ex%,1)
  426. if (p1x%=640) then
  427.     print "Q"+chr$(32);
  428.     call fillrect(120,8,370,10)
  429.     print "Q"+chr$(35);
  430.     print"  *****";
  431.     return
  432. endif
  433. if (p1x%=630) then print" ' ,' ,'";
  434.     return
  435. endif
  436. if (p1x%=620) then print". '   . '";
  437.     return
  438. endif
  439. if (p1x%=610) then print"          ";
  440.     wave%=wave%+1
  441.     if(mod%(wave%,10)=0) then level%=level%+1 endif
  442.     call score
  443.         if(explode%) then 
  444.             call destruct
  445.             endproc
  446.         endif
  447.         if(drop%=0) then
  448.             c%=0
  449.             loop for i%=1 to 6
  450.                 c%=c%+ms%[i%]
  451.             endloop
  452.             if c%=0 then explode%=1
  453.             endif
  454.         endif
  455. endif
  456. endproc
  457.  
  458. procedure demo
  459.  
  460.     if (k%<>0) then
  461.         demo%=0
  462.         call init
  463.         call clrscr
  464.         call draw_base
  465.         call score
  466.         call curpos(34,7)
  467.         print"GET READY !";
  468.         wait 2
  469.         call curpos(34,7)
  470.         print"           ";
  471.         return
  472.     endif
  473.  
  474.     !GAME OVER MOVEMENT (DEMO)
  475.     call curpos(gnx%,gny%)
  476.     print"GAME OVER";
  477.     call curpos(gox%,goy%)
  478.     print"         ";
  479.     gox%=gnx%
  480.     goy%=gny%
  481.     gnx%=gnx%+gdx%
  482.     if(gnx%>68) then
  483.         gdx%=-1
  484.         call hiscore
  485.     endif
  486.     if(gnx%<2) then
  487.         gdx%=1
  488.         call hiscore
  489.     endif
  490.     gny%=gny%+gdy%
  491.     if(gny%>12) then
  492.         gdy%=-1
  493.         call hiscore
  494.     endif
  495.     if(gny%<2) then
  496.         gdy%=1
  497.         call hiscore
  498.     endif
  499.     
  500.     !SHOT MOVEMENT (DEMO)
  501.     if(shot%=0) then
  502.         k%=step%+48
  503.         step%=step%+1
  504.         if(step%>7) then
  505.             step%=0
  506.         endif
  507.     endif
  508. endproc
  509.  
  510. procedure init
  511.     score%=0
  512.     wave%=1
  513.     level%=0
  514.     timer%=15
  515.     shot%=0
  516.     step%=0
  517.     gox%=30
  518.     goy%=4
  519.     gnx%=gox%
  520.     gny%=goy%
  521.     gdx%=1
  522.     gdy%=1
  523.     p1x%=500
  524.     p1y%=8
  525.     man%=1
  526.     loop for i%=1 to 6
  527.         ms%[i%]=0
  528.     endloop
  529.     loop for i%=1 to 46
  530.         gr%[i%]=0
  531.     endloop
  532.     cur_man%=1
  533.     landr%=0
  534.     landl%=0
  535.     drop%=1
  536.     explode%=0
  537. endproc
  538.  
  539. procedure plot(px%,py%)        ! Clone of POINT !
  540.    print "P"+chr$(shift%(px%,-6)+1)+chr$((px% and 63)+1)+\
  541.                          chr$(shift%(py%,-6)+1)+chr$((py% and 63)+1);
  542. endproc
  543.  
  544. procedure halt  ! It's better than PAUSE cause doesn't slow down.
  545.     loop
  546.         wait 0.1
  547.         k$=key$
  548.         while len%(k$)=0
  549.     endloop
  550. endproc
  551.  
  552. procedure start
  553. call title
  554. print""
  555. print"               An Apple][ classic for BasiCE by Ricardo Barijan"
  556. print""
  557. print"                      Press any key to start a new game"
  558. print"              Use keys 1 2 3 4 5 6 and 7 to fire and P to pause"
  559. print"             Press BackSpace to end game and return to demo mode"
  560. print"                     During demo press BackSpace to quit"
  561. print"  Check for new games at http://www.geocities.com/SiliconValley/Park/7794"
  562. print""
  563. print"                          PRESS ANY KEY TO CONTINUE";
  564. call halt
  565. call clrscr
  566. endproc
  567.  
  568. procedure title
  569. print"         ****    ****   *****    ****   ******   ****    ****   ******"
  570. print"        **  **  **  **  **  **  **  **    **    **  **  **  **  **"
  571. print"        **      **  **  **  **  **  **    **    **  **  **      **"
  572. print"        *****   ******  *****   **  **    **    ******  ** ***  *****"
  573. print"         *****  ******  *****   **  **    **    ******  ** ***  *****"
  574. print"            **  **  **  **  **  **  **    **    **  **  **  **  **"
  575. print"        **  **  **  **  **  **  **  **    **    **  **  **  **  **"
  576. print"         ****   **  **  *****    ****     **    **  **   ****   ******   V:1.1"   
  577. endproc
  578.  
  579. procedure test1        ! Not used in normal game !
  580.        print "Q"+chr$(32);
  581.     call fillrect(tx%,ty%,tx%+13,ty%+17)
  582.     print "Q"+chr$(35);
  583. if k$="h" then tx%=tx%-10 endif
  584. if k$="j" then tx%=tx%+10 endif
  585. if k$="u" then ty%=ty%-4 endif
  586. if k$="n" then ty%=ty%+4 endif
  587. x%=tx%
  588. y%=ty%
  589. call curpos(15,0)
  590. print "x:"x%"  y:"y%" ";
  591.         call fillrect(x%+5,y%+7,x%+8,y%+10)
  592.         call fillrect(x%+5,y%+12,x%+8,y%+17)
  593.         call line(x%+3,y%+11,x%+10,y%+11)
  594.         call line(x%+3,y%,x%+10,y%)
  595.         call line(x%,y%+3,x%+3,y%)
  596.         call line(x%+10,y%+1,x%+13,y%+4)
  597.         call line(x%+1,y%+4,x%+4,y%+7)
  598.         call line(x%+9,y%+6,x%+12,y%+3)
  599.         call line(x%+6,y%+1,x%+6,y%+6)
  600. !*********
  601. endproc
  602.  
  603. procedure test2        ! Not used in normal game !
  604.     loop for i%=1 to 46
  605.         if(gr%[i%]) then
  606.             call fillrect(i%*10-4,130,i%*10,134)
  607.         endif
  608.     endloop
  609.     call curpos(40,0)
  610.     print"L:"landl%"  R:"landr%" ";
  611. endproc
  612.  
  613. procedure destruct
  614. call score
  615. if(shot%>0) then
  616.     print "Q"+chr$(32);
  617.     call shot
  618.     print "Q"+chr$(35);
  619.     shot%=0
  620. endif
  621.  
  622. if(landl%>2) then
  623.     seek%=-1
  624.     come%=1
  625.     meet%=22
  626. else
  627.     seek%=1
  628.     come%=-1
  629.     meet%=26
  630. endif
  631. man%=meet%
  632. n%=3
  633. loop
  634.     loop
  635.         man%=man%+seek%
  636.         while gr%[man%]=0
  637.     endloop
  638.     loop
  639.         x%=man%*10-6
  640.         print "Q"+chr$(32);
  641.         call fillrect(x%+3,155,x%+10,165)
  642.         print "Q"+chr$(35);
  643.         gr%[man%]=0
  644.         man%=man%+come%
  645.         gr%[man%]=1
  646.         call draw_base
  647.         wait 0.25
  648.         while man%<>meet%
  649.     endloop
  650.     meet%=meet%+seek%
  651.     n%=n%-1
  652.     while n%<>0
  653. endloop
  654. x%=(meet%+come%)*10-6
  655. wait 0.05
  656. call line(x%+5+20*come%,159,x%+5+20*come%+10*seek%,159)
  657. wait 0.05
  658. gr%[man%]=0
  659. h%=0
  660. print "Q"+chr$(32);
  661.     x%=man%*10-6
  662.     call fillrect(x%+5,155,x%+8,158)
  663.     call fillrect(x%+5,160,x%+8,165)
  664.     call line(x%+3,159,x%+10,159)
  665. print "Q"+chr$(35);
  666. x%=x%+5*seek%
  667. loop
  668.     print "Q"+chr$(32);
  669.     call fillrect(x%+3,155-h%,x%+10,165-h%)
  670.     print "Q"+chr$(35);
  671.     x%=x%+come%*5
  672.     y%=jump%[1+n%]
  673.     h%=148-y%
  674.     call fillrect(x%+5,155-h%,x%+8,158-h%)
  675.     call fillrect(x%+5,160-h%,x%+8,165-h%)
  676.     call line(x%+3,159-h%,x%+10,159-h%)
  677.     wait 0.1
  678.     n%=n%+1
  679.     while n%<>7
  680. endloop
  681.  
  682. call score
  683. call draw_base
  684.  
  685. wait 0.1
  686. x%=234
  687. y%=145
  688. call line(x%,y%,x%-5,y%-3)
  689. call line(x%-5,y%-3,x%+4,y%-2)
  690. call line(x%+4,y%-2,x%+1,y%-8)
  691. call line(x%+1,y%-8,x%+7,y%-4)
  692. call line(x%+7,y%-4,x%+10,y%-10)
  693. call line(x%+10,y%-10,x%+10,y%-2)
  694. call line(x%+10,y%-2,x%+16,y%-5)
  695. call line(x%+16,y%-5,x%+12,y%+1)
  696. wait 0.04
  697.  
  698. print "Q"+chr$(32);
  699. call fillrect(237,149,243,152)
  700. call line(x%,y%,x%-5,y%-3)
  701. call line(x%-5,y%-3,x%+4,y%-2)
  702. call line(x%+4,y%-2,x%+1,y%-8)
  703. call line(x%+1,y%-8,x%+7,y%-4)
  704. call line(x%+7,y%-4,x%+10,y%-10)
  705. call line(x%+10,y%-10,x%+10,y%-2)
  706. call line(x%+10,y%-2,x%+16,y%-5)
  707. call line(x%+16,y%-5,x%+12,y%+1)
  708. print "Q"+chr$(35);
  709.  
  710. x%=228
  711. y%=144
  712. call line(x%,y%,x%-11,y%-6)
  713. call line(x%-11,y%-6,x%+6,y%-4)
  714. call line(x%+6,y%-4,x%,y%-14)
  715. call line(x%,y%-14,x%+11,y%-9)
  716. call line(x%+11,y%-9,x%+14,y%-20)
  717. call line(x%+14,y%-20,x%+17,y%-9)
  718. call line(x%+17,y%-9,x%+26,y%-13)
  719. call line(x%+26,y%-13,x%+20,y%-5)
  720. call line(x%+20,y%-5,x%+34,y%-6)
  721. call line(x%+34,y%-6,x%+19,y%)
  722.  
  723. print "Q"+chr$(32);
  724. call fillrect(238,151,242,153)
  725. call line(238,152,242,156)
  726. wait 0.3
  727. call line(x%,y%,x%-11,y%-6)
  728. call line(x%-11,y%-6,x%+6,y%-4)
  729. call line(x%+6,y%-4,x%,y%-14)
  730. call line(x%,y%-14,x%+11,y%-9)
  731. call line(x%+11,y%-9,x%+14,y%-20)
  732. call line(x%+14,y%-20,x%+17,y%-9)
  733. call line(x%+17,y%-9,x%+26,y%-13)
  734. call line(x%+26,y%-13,x%+20,y%-5)
  735. call line(x%+20,y%-5,x%+34,y%-6)
  736. call line(x%+34,y%-6,x%+19,y%)
  737. call line(242,156,240,158)
  738. call line(240,158,242,160)
  739. print "Q"+chr$(35);
  740.  
  741. if(demo%) then
  742.     wait 1
  743. else
  744.     loop for i%=1 to 16
  745.         wait 0.02
  746.         k$=key$
  747.     endloop
  748.     if (score%>hiscore%) then
  749.         hiscore%=score%
  750.         call curpos(23,5)
  751.         print" CONGRATULATIONS!  NEW HI-SCORE! "
  752.         call save_hi
  753.     endif
  754.     loop
  755.         call curpos(34,7)
  756.         print" GAME OVER ";
  757.         call curpos(32,8)
  758.         print" PRESS ANY KEY "
  759.         wait 0.1
  760.         k$=key$
  761.         while len%(k$)=0
  762.     endloop
  763. endif
  764.  
  765. call init
  766. call clrscr
  767. call hiscore
  768. demo%=1
  769. k%=0
  770. endproc
  771.  
  772. procedure read_hi
  773.     done%=0
  774.     ON "ERROR" CALL ERR_HANDLER
  775.     OPEN "sabotage.hsc",1
  776.     if(done%) then return endif
  777.         INPUT #1,dt#
  778.         hiscore%=dt#
  779.     close 1
  780. endproc
  781.  
  782. procedure save_hi
  783.     done%=0
  784.     ON "ERROR" CALL ERR_HANDLER
  785.      CREATE "sabotage.hsc",1
  786.     if(done%) then return endif
  787.         dt#=hiscore%
  788.         print #1,dt#
  789.         print #1,"Sabotage hi-score file"
  790.     close 1
  791. endproc
  792. PROCEDURE ERR_HANDLER
  793. ! Do nothing, just ignore i/o error if it happens !
  794. done%=1
  795. ENDPROC
  796.  
  797. procedure set_table
  798. jump%[1]=144
  799. jump%[2]=140
  800. jump%[3]=136
  801. jump%[4]=141
  802. jump%[5]=136
  803. jump%[6]=134
  804. jump%[7]=138
  805. endproc
  806.  
  807. ! BasiCE library files already included here. Just in case !
  808.  
  809. procedure clrscr
  810.    print "C";
  811. endproc
  812.  
  813. procedure line( x1%,y1%,x2%,y2%)
  814.    print "L";chr$(shift%(x1%,-6)+1);chr$((x1% and 63)+1);\
  815.               chr$(shift%(y1%,-6)+1);chr$((y1% and 63)+1);
  816.  
  817.    print      chr$(shift%(x2%,-6)+1);chr$((x2% and 63)+1);\
  818.               chr$(shift%(y2%,-6)+1);chr$((y2% and 63)+1);
  819. endproc
  820.  
  821. procedure fillrect( x1%,y1%,x2%,y2%)
  822.    print "R";chr$(shift%(x1%,-6)+1);chr$((x1% and 63)+1);\
  823.               chr$(shift%(y1%,-6)+1);chr$((y1% and 63)+1);
  824.  
  825.    print      chr$(shift%(x2%,-6)+1);chr$((x2% and 63)+1);\
  826.               chr$(shift%(y2%,-6)+1);chr$((y2% and 63)+1);
  827. endproc
  828.  
  829. procedure curpos(c%,r%)
  830.    print "G";chr$(c%+1);chr$(r%+1);
  831.    endproc
  832.  
  833.