home *** CD-ROM | disk | FTP | other *** search
/ Internet 1996 World Exposition / park.org.s3.amazonaws.com.7z / park.org.s3.amazonaws.com / Japan / Panasonic- / events / gento / Panachan.dcr / 00031.ls < prev    next >
Encoding:
Text File  |  2017-09-21  |  8.1 KB  |  328 lines

  1. global stagewidth, stageheight, stagehtop, stagehbottom, stagehleft, stagehright, stagehtop2, stagehbottom2, stagehleft2, stagehright2, startholeh, startholev, panah, panav, panacatchh, panacatchv, panapicuph, panapicupv, panawalkcount, panadir, pananowh, pananowv, defsphanafront, defsphanaback, defspgomfront, defspgomback, defsphead, defrighteye, deflefteye
  2.  
  3. on panawalk
  4.   cursor([6, 7])
  5.   set mh to the mouseH
  6.   set mv to the mouseV
  7.   set pananowh to the locH of sprite defsphanaback
  8.   set pananowv to the locV of sprite defsphanaback
  9.   set block to 22 * 8 * (panadir - 1)
  10.   set panawalkcount to 1
  11.   set l to 0.0
  12.   repeat while the stillDown
  13.     if (abs(startholeh - the locH of sprite defsphead) < 23) and (abs(startholev - the locV of sprite defsphead) < 15) then
  14.       return 0
  15.     end if
  16.     set mh to the mouseH
  17.     set mv to the mouseV
  18.     set d to getpanadir(mh, mv)
  19.     if d = -1 then
  20.       next repeat
  21.     else
  22.       if d = 0 then
  23.         set d to panadir
  24.       else
  25.         if d = 3 then
  26.           set the visible of sprite defsphanafront to 0
  27.           set the visible of sprite defspgomfront to 0
  28.         else
  29.           set the visible of sprite defsphanafront to 1
  30.           set the visible of sprite defspgomfront to 1
  31.         end if
  32.       end if
  33.     end if
  34.     set panadir to d
  35.     movelochv(defsphanaback, mh, mv)
  36.     movelochv(defsphanafront, mh, mv)
  37.     set block to 22 * 8 * (panadir - 1)
  38.     set l to setwalkfigure(mh, mv, block, 9)
  39.     setgomhana(pananowh, pananowv, mh, mv)
  40.     updateStage()
  41.   end repeat
  42.   cursor([4, 5])
  43.   if l >= 80.0 then
  44.     if l >= 160.0 then
  45.       if panaboundinghead(mh, mv, block) then
  46.         return 1
  47.       end if
  48.       Wait(20)
  49.     else
  50.       if panaheadcutoff(mh, mv, block) then
  51.         return 1
  52.       end if
  53.       cursor(0)
  54.       if panadir <> 3 then
  55.         panawink()
  56.       end if
  57.       pananoheadwalk(block)
  58.       panaheadpicup()
  59.       Wait(15)
  60.       panaheadcatch()
  61.       Wait(20)
  62.       panabacktostage(the locH of sprite defsphanaback, the locV of sprite defsphanaback)
  63.     end if
  64.     panastop(22 * 8 * (panadir - 1))
  65.     if panadir <> 3 then
  66.       panawink()
  67.     end if
  68.   else
  69.     panaheadboing(mh, mv, block)
  70.     cursor(0)
  71.     panabacktostage(the locH of sprite defsphanaback, the locV of sprite defsphanaback)
  72.     if panadir <> 3 then
  73.       panawink()
  74.     end if
  75.     panastop(22 * 8 * (panadir - 1))
  76.   end if
  77.   return 0
  78. end
  79.  
  80. on panastop block
  81.   movelochv(defsphanaback, pananowh, pananowv)
  82.   movelochv(defsphanafront, pananowh, pananowv)
  83.   spriteBox(defspgomback, pananowh, pananowv, pananowh, pananowv)
  84.   spriteBox(defspgomfront, pananowh, pananowv, pananowh, pananowv)
  85.   set th to pananowh - getAt(panah, block + 1)
  86.   set tv to pananowv - getAt(panav, block + 1)
  87.   set step to block - 7
  88.   repeat with n = 9 to 28
  89.     movelochv(n, th + getAt(panah, step + n), tv + getAt(panav, step + n))
  90.   end repeat
  91.   updateStage()
  92. end
  93.  
  94. on setwalkfigure mh, mv, block, loops
  95.   set h0 to mh - pananowh
  96.   set v0 to mv - pananowv
  97.   set l to sqrt(float((h0 * h0) + (v0 * v0)))
  98.   if l = 0.0 then
  99.     return 0.0
  100.   end if
  101.   set th to integer(h0 / l * 2.0)
  102.   set tv to integer(v0 / l * 2.0)
  103.   if abs(h0) < abs(th) then
  104.     set th to h0
  105.   end if
  106.   if abs(v0) < abs(tv) then
  107.     set tv to v0
  108.   end if
  109.   set pananowh to pananowh + th
  110.   set pananowv to pananowv + tv
  111.   set th to pananowh - getAt(panah, block + 1)
  112.   set tv to pananowv - getAt(panav, block + 1)
  113.   set step to block + (22 * (panawalkcount - 1)) - 7
  114.   repeat with n = loops to 28
  115.     movelochv(n, th + getAt(panah, step + n), tv + getAt(panav, step + n))
  116.   end repeat
  117.   set panawalkcount to panawalkcount + 1
  118.   if panawalkcount = 9 then
  119.     set panawalkcount to 1
  120.   end if
  121.   return l
  122. end
  123.  
  124. on panawink
  125.   set the visible of sprite defrighteye to 0
  126.   set the visible of sprite deflefteye to 0
  127.   updateStage()
  128.   Wait(5)
  129.   set the visible of sprite defrighteye to 1
  130.   set the visible of sprite deflefteye to 1
  131.   updateStage()
  132.   Wait(5)
  133.   set the visible of sprite defrighteye to 0
  134.   set the visible of sprite deflefteye to 0
  135.   updateStage()
  136.   Wait(40)
  137.   repeat with n = 1 to 4
  138.     set the visible of sprite defrighteye to 1
  139.     set the visible of sprite deflefteye to 1
  140.     updateStage()
  141.     Wait(5)
  142.     set the visible of sprite defrighteye to 0
  143.     set the visible of sprite deflefteye to 0
  144.     updateStage()
  145.     Wait(5)
  146.   end repeat
  147.   set the visible of sprite defrighteye to 1
  148.   set the visible of sprite deflefteye to 1
  149.   updateStage()
  150. end
  151.  
  152. on setgomhana h0, v0, mh, mv
  153.   if h0 < mh then
  154.     if panadir = 4 then
  155.       set h0 to h0 - 1
  156.     else
  157.       set h0 to h0
  158.     end if
  159.     if v0 < mv then
  160.       set the castNum of sprite defspgomback to 2
  161.       set the castNum of sprite defspgomfront to 2
  162.       spriteBox(defspgomback, h0, v0, mh, mv)
  163.       spriteBox(defspgomfront, h0, v0, mh, mv)
  164.     else
  165.       if v0 = mv then
  166.         set mv to mv - 1
  167.       end if
  168.       set the castNum of sprite defspgomback to 3
  169.       set the castNum of sprite defspgomfront to 3
  170.       spriteBox(defspgomback, h0, mv, mh, v0)
  171.       spriteBox(defspgomfront, h0, mv, mh, v0)
  172.     end if
  173.   else
  174.     if panadir = 2 then
  175.       set h1 to h0 + 1
  176.     else
  177.       set h1 to h0
  178.     end if
  179.     if h0 = mh then
  180.       set mh to mh - 1
  181.     end if
  182.     if v0 < mv then
  183.       set the castNum of sprite defspgomback to 3
  184.       set the castNum of sprite defspgomfront to 3
  185.       spriteBox(defspgomback, mh, v0, h1, mv)
  186.       spriteBox(defspgomfront, mh, v0, h1, mv)
  187.     else
  188.       if v0 = mv then
  189.         set mv to mv - 1
  190.       end if
  191.       set the castNum of sprite defspgomback to 2
  192.       set the castNum of sprite defspgomfront to 2
  193.       spriteBox(defspgomback, mh, mv, h1, v0)
  194.       spriteBox(defspgomfront, mh, mv, h1, v0)
  195.     end if
  196.   end if
  197. end
  198.  
  199. on getpanadir mh, mv
  200.   set h to mh - pananowh
  201.   set v to mv - pananowv
  202.   if (abs(h) <= 2) and (abs(v) <= 2) then
  203.     return -1
  204.   end if
  205.   if h = 0 then
  206.     if v > 0 then
  207.       set d to 1
  208.     else
  209.       if v < 0 then
  210.         set d to 3
  211.       else
  212.         set d to 0
  213.       end if
  214.     end if
  215.   else
  216.     set c to abs(v / h)
  217.     if h > 0 then
  218.       if v > 0 then
  219.         if c <= 1.0 then
  220.           set d to 4
  221.         else
  222.           set d to 1
  223.         end if
  224.       else
  225.         if c <= 1.0 then
  226.           set d to 4
  227.         else
  228.           set d to 3
  229.         end if
  230.       end if
  231.     else
  232.       if v > 0 then
  233.         if c <= 1.0 then
  234.           set d to 2
  235.         else
  236.           set d to 1
  237.         end if
  238.       else
  239.         if c <= 1.0 then
  240.           set d to 2
  241.         else
  242.           set d to 3
  243.         end if
  244.       end if
  245.     end if
  246.   end if
  247.   if panadir = 1 then
  248.     if (d = 2) and (h < -15) then
  249.       set d to 2
  250.     else
  251.       if (d = 3) and (v < -15) then
  252.         set d to 3
  253.       else
  254.         if (d = 4) and (h > 15) then
  255.           set d to 4
  256.         else
  257.           set d to 0
  258.         end if
  259.       end if
  260.     end if
  261.   else
  262.     if panadir = 2 then
  263.       if (d = 1) and (v > 15) then
  264.         set d to 1
  265.       else
  266.         if (d = 3) and (v < -15) then
  267.           set d to 3
  268.         else
  269.           if d = 4 then
  270.             if h > 30 then
  271.               set d to 4
  272.             else
  273.               if h > 7 then
  274.                 set d to 1
  275.               else
  276.                 set d to 0
  277.               end if
  278.             end if
  279.           else
  280.             set d to 0
  281.           end if
  282.         end if
  283.       end if
  284.     else
  285.       if panadir = 3 then
  286.         if (d = 1) and (v > 15) then
  287.           set d to 1
  288.         else
  289.           if (d = 2) and (h < -15) then
  290.             set d to 2
  291.           else
  292.             if (d = 4) and (h > 15) then
  293.               set d to 4
  294.             else
  295.               set d to 0
  296.             end if
  297.           end if
  298.         end if
  299.       else
  300.         if panadir = 4 then
  301.           if (d = 1) and (v > 15) then
  302.             set d to 1
  303.           else
  304.             if d = 2 then
  305.               if h < -30 then
  306.                 set d to 2
  307.               else
  308.                 if h < -15 then
  309.                   set d to 1
  310.                 else
  311.                   set d to 0
  312.                 end if
  313.               end if
  314.             else
  315.               if (d = 3) and (v < -15) then
  316.                 set d to 3
  317.               else
  318.                 set d to 0
  319.               end if
  320.             end if
  321.           end if
  322.         end if
  323.       end if
  324.     end if
  325.   end if
  326.   return d
  327. end
  328.