home *** CD-ROM | disk | FTP | other *** search
/ The Very Best of Atari Inside / The Very Best of Atari Inside 1.iso / sharew / spiele / kids / worm / designer.bas < prev    next >
Encoding:
BASIC Source File  |  1995-08-15  |  5.6 KB  |  309 lines

  1. gosub init_vars
  2.  
  3. draw_screen
  4.  
  5. status
  6.  
  7. mainloop:
  8.     while q$<>"Q"
  9.         x=mouse(0):y=mouse(1)
  10.         if snap<0 then
  11.             x=int(x/8.5)*8.5-6:y=int(y/8.5)*8.5-5
  12.         end if
  13.         if x>10 and y>10 and x<310 and y<150
  14.             mouse -1
  15.             get(x,y)-(x+s(p,0)*16,y+s(p,1)*16),stor
  16.             color 1,1,1
  17.             bar x-11,y-11,s(p,0)*16,s(p,1)*16
  18.             color p+1,p+1,p+1
  19.             if p>16 then
  20.                 color 0,0,0
  21.             end if
  22.             bar x-10,y-10,s(p,0)*14,s(p,1)*14
  23.             put(x,y),stor,pset
  24.         else
  25.             mouse 0
  26.         end if            
  27.         if mouse(2)<>0 and x>10 and x<309 and y>10 and y<150 then
  28.             color 1,1,1
  29.             bar x-11,y-11,s(p,0)*16,s(p,1)*16
  30.             color p+1,p+1,p+1
  31.             if p>16 then
  32.                 color 0,0,0
  33.             end if
  34.             bar x-10,y-10,s(p,0)*14,s(p,1)*14
  35.             color 1,1,1
  36.             scrn(n(s_n),0,s_n)=p
  37.             scrn(n(s_n),1,s_n)=x
  38.             scrn(n(s_n),2,s_n)=y
  39.             n(s_n)=n(s_n)+1
  40.             if p>99 and p<200 then
  41.                 get_alien_info
  42.             end if
  43.             while mouse(2)<>0
  44.             wend
  45.         end if
  46.         q$=inkey$
  47.         if q$="" then
  48.             q$=" "
  49.         end if
  50.         if val(q$)<>0 then
  51.             p=val(q$)
  52.             status
  53.         else
  54.             if q$="+" then
  55.                 p=p+1
  56.                 status
  57.             end if
  58.             if q$="-" then
  59.                 p=p-1
  60.                 status
  61.             end if
  62.             q$=chr$(asc(q$) and 223)
  63.             if q$="N" then
  64.                 window output 1
  65.                 cls
  66.                 input"Screen #n:";s_n
  67.                 status
  68.                 draw_l
  69.             end if
  70.             if q$="W" then
  71.                 n(s_n)=0:cls
  72.                 status
  73.             end if
  74.             if q$="O" then
  75.                 window output 1
  76.                 cls
  77.                 input"OBJECT #n:";a
  78.                 p=a+199
  79.                 status
  80.             end if
  81.             if q$="A" then
  82.                 window output 1
  83.                 cls
  84.                 input"ALIEN/MOTILE #n:";a
  85.                 p=a+99
  86.                 status
  87.             end if
  88.             if q$="G" then
  89.                 snap=-snap
  90.                 window output 1
  91.                 status
  92.             end if
  93.             if Q$="S" then
  94.                 save_screen
  95.             end if
  96.             if q$="L" then
  97.                 load_screen
  98.             end if
  99.         end if
  100.     wend
  101.  
  102. stop
  103.  
  104. sub status
  105. shared p,snap,n(),s_n,item$()
  106.     window output 1
  107.     cls
  108.     if p>100 then
  109.         if p>200 then
  110.             ?"Object:";
  111.         else
  112.             ?"Motile:";
  113.         end if
  114.     else
  115.         ?"Scenery:";
  116.     end if
  117.     ?item$(p);"    #n:";n(s_n)
  118.     ?"Snap:";
  119.     if snap<0 then
  120.         ?"ON";
  121.     else
  122.         ?"OFF";
  123.     end if
  124.     ?"   Screen:";s_n;
  125.     window output 2
  126. end sub
  127.  
  128. sub get_alien_info
  129. shared scrn(),stor(),x,y,n(),s_n,s(),p,snap
  130.     get(0,0)-(319,199),stor
  131.     mouse -1
  132.     while mouse(2)<>0
  133.     wend
  134.     while mouse(2)=0
  135.         mx=mouse(0)
  136.         if snap<0 then
  137.             mx=int(mx/8.5)*8.5-6
  138.         end if
  139.         put(0,0),stor,pset
  140.         linef x-12,y-10+s(p,1)*8,mx-12,y-10+s(p,1)*8
  141.         linef mx-12,y-15+s(p,1)*8,mx-12,y-5+s(p,1)*8
  142.     wend
  143.     scrn(n(s_n),0,s_n)=mx
  144.     get(0,0)-(319,199),stor
  145.     while mouse(2)<>0
  146.     wend
  147.     while mouse(2)=0
  148.         mx=mouse(0)
  149.         if snap<0 then
  150.             mx=int(mx/8.5)*8.5-6
  151.         end if
  152.         put(0,0),stor,pset
  153.         linef x-10+s(p,0)*16,y-10+s(p,1)*8,mx-14+s(p,0)*16,y-10+s(p,1)*8
  154.         linef mx-14+s(p,0)*16,y-5+s(p,1)*8,mx-14+s(p,0)*16,y-15+s(p,1)*8
  155.     wend
  156.     scrn(n(s_n),2,s_n)=mx
  157.     get(0,0)-(319,199),stor
  158.     while mouse(2)<>0
  159.     wend
  160.     while mouse(2)=0
  161.         my=mouse(1)
  162.         if snap<0 then
  163.             my=int(my/8.5)*8.5-5
  164.         end if
  165.         put(0,0),stor,pset
  166.         linef x-12+s(p,0)*8,y-10,x-12+s(p,0)*8,my-10
  167.         linef x-9+s(p,0)*8,my-10,x-15+s(p,1)*8,my-10
  168.     wend
  169.     scrn(n(s_n),1,s_n)=my
  170.     get(0,0)-(319,199),stor
  171.     while mouse(2)<>0
  172.     wend
  173.     while mouse(2)=0
  174.         my=mouse(1)
  175.         if snap<0 then
  176.             my=int(my/8.5)*8.5-5
  177.         end if
  178.         put(0,0),stor,pset
  179.         linef x-12+s(p,0)*8,y-10+s(p,1)*16,x-12+s(p,0)*8,my-10+s(p,1)*16
  180.         linef x-9+s(p,0)*8,my-10+s(p,1)*16,x-15+s(p,0)*8,my-10+s(p,1)*16
  181.     wend
  182.     scrn(n(s_n)+1,0,s_n)=my
  183.     window output 1
  184.     cls:input"DIRECTION:";a
  185.     status
  186.     scrn(n(s_n)+1,1,s_n)=a:scrn(n(s_n)+1,2,s_n)=0
  187.     n(s_n)=n(s_n)+2
  188.     MOUSE 0
  189. end sub
  190.  
  191. sub save_screen
  192. shared n(),s_n,scrn(),stor()
  193.     window output 1
  194.     cls
  195.     ?"SAVE TO DISC"
  196.     input"FILENAME:";n$:cls
  197.     n$=n$+".SCR"
  198.     s=varptr(stor(0)):p=0
  199.     ns=0
  200.     while ns<>25 and ns<>1
  201.         input"NUMBER OF SCREENS (1 or 25)";ns
  202.     wend
  203.     
  204.     for s_n=1 to ns
  205.         if n(s_n)<>0 then
  206.             for f=0 to n(s_n)-1:for a=0 to 2
  207.                 pokew s+p,scrn(f,a,s_n)
  208.                 p=p+2
  209.                 gotoxy 0,0
  210.             next a,f
  211.         end if
  212.         pokel s+p,0:pokew s+p+4,0
  213.         p=p+6
  214.     next s_n
  215.     
  216.     bsave n$,s,p+2
  217.     s_n=1
  218.     
  219.     status
  220. end sub
  221.  
  222. sub load_screen
  223. shared n(),s_n,scrn(),stor()
  224.     window output 1
  225.     cls
  226.     ?"LOAD FROM DISC"
  227.     input"FILENAME:";n$:cls
  228.     n$=n$+".SCR"
  229.     ns=0
  230.     while ns<>25 and ns<>1
  231.         input"NUMBER OF SCREENS (1 or 25)";ns
  232.     wend
  233.     
  234.     s=varptr(stor(0))
  235.     bload n$,s
  236.     p=0
  237.     for s_n=1 to ns
  238.         n(s_n)=0
  239.         while peekw(s+p)<>0
  240.             n(s_n)=n(s_n)+1
  241.             p=p+6
  242.         wend
  243.         p=p+6
  244.     next s_n
  245.     p=0
  246.     for s_n=1 to ns
  247.         for f=0 to n(s_n)-1:for a=0 to 2
  248.             scrn(f,a,s_n)=peekw(s+p)
  249.             p=p+2
  250.         next a,f
  251.         p=p+6
  252.     next s_n
  253.     s_n=1
  254.     status
  255.     draw_l
  256. end sub
  257.  
  258. sub draw_l
  259. shared n(),s_n,scrn(),s()
  260.     cls
  261.     for f=0 to n(s_n)-1
  262.         x=scrn(f,1,s_n):y=scrn(f,2,s_n)
  263.         p=scrn(f,0,s_n)
  264.         color 1,1,1
  265.         bar x-11,y-11,16*s(p,0),16*s(p,1)
  266.         color p+1,p+1,p+1
  267.         bar x-10,y-10,14*s(p,0),14*s(p,1)
  268.     next f
  269. end sub
  270.  
  271. sub draw_screen
  272.     window open 1,"GMET SCREEN DESIGNER",0,155,320,40,1
  273.     
  274.     window open 2,"",10,10,300,140,0
  275.     
  276. end sub
  277.  
  278. init_vars:
  279. dim scrn(500,2,25),stor(10000),s(250,1),n(25)
  280. p=1:snap=1:s_n=1
  281. dim item$(250)
  282. for f=1 to 14:read item$(f),s(f,0),s(f,1):next f
  283. FOR f=100 to 103
  284.     read item$(f),s(f,0),s(f,1)
  285. next f
  286. for f=200 to 205
  287.     read item$(f),s(f,0),s(f,1)
  288. next f
  289.  
  290. return
  291.  
  292. rem SCENERY DATA
  293.  
  294. data OLD BRICKS,1,1,BLUEBALL,1,1,GRASS,1,1,PLAYER WORM START,2,0.6            
  295. data TREES,1,2,PILLAR,1,1
  296. data HORIZ.PIPE,1,0.5,VERT.PIPE,0.5,1,CONECT PIPE,1.5,1.5
  297. data HORIZ.BONES,1,0.5,VERT.BONES,0.5,1,CONECT BONES,1.5,1.5
  298. data SHORT STALAGTITE,1,1,LONG STALAGTITE,1,2
  299.  
  300. rem ALIEN/MOTILE DATA
  301.  
  302. data EVIL EYE,2,2,PLATFORM,2,2,POWER DRILL,2,2
  303. data MANIC MUSHROOM,2,2
  304.  
  305. rem OBJECT DATA
  306.  
  307. data WORM EGG,1,1,EXTRA LIFE,1,1,EXTRA FUEL,1,1
  308. data BONUS DIAMOND,1,1,INVULNERABILITY,1,1
  309. data FREEZE ALIENS,1,1