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 / 00032.ls < prev    next >
Encoding:
Text File  |  2017-09-21  |  13.9 KB  |  493 lines

  1. global stagewidth, stageheight, stagehtop, stagehbottom, stagehleft, stagehright, stagehtop2, stagehbottom2, stagehleft2, stagehright2, startholeh, startholev, startholeh2, startholev2, panah, panav, panacatchh, panacatchv, panapicuph, panapicupv, panaboundh, panaboundv, panawalkcount, panadir, pananowh, pananowv, panacharh0, panacharv0, panacharha, panacharva, cl_pana, cl_sonic, cl_fun_city, cl_olympic, cl_yawara_chan, cl_time_capusule, panacharlist, panacharcount, panacharend, defsphanafront, defsphanaback, defspgomfront, defspgomback, defsphead, defrighteye, deflefteye
  2.  
  3. on panaboundinghead mh, mv, block
  4.   if (pananowh < stagehleft2) or (pananowh > stagehright2) or (pananowv < stagehtop2) or (pananowv > stagehbottom2) then
  5.     panaheadcatch()
  6.     cursor(0)
  7.     panabacktostage(the locH of sprite defsphanaback, the locV of sprite defsphanaback)
  8.     return 0
  9.   end if
  10.   set av to -(mv - pananowv) / 2.0
  11.   set ah to -(mh - pananowh) / 2.0
  12.   set h0 to the locH of sprite defsphead
  13.   set v0 to the locV of sprite defsphead
  14.   set h00 to h0
  15.   set v00 to v0
  16.   set hh to getAt(panah, block + 1) - getAt(panah, block + 2)
  17.   set vv to getAt(panav, block + 1) - getAt(panav, block + 2)
  18.   set panasw to 0
  19.   set timeh to 0.40000000000000002
  20.   set timev to 0.40000000000000002
  21.   repeat while 1
  22.     set h1 to h0 + (ah * timeh)
  23.     set v1 to v0 + (av * timev)
  24.     if (h1 < stagehleft) and (ah < 0.0) then
  25.       if (panasw = 0) and (random(15) = 1) then
  26.         set panasw to 1
  27.       end if
  28.       set h1 to stagehleft
  29.       set h0 to stagehleft
  30.       set ah to -ah
  31.       set timeh to 0.0
  32.     else
  33.       if (h1 > stagehright) and (ah > 0.0) then
  34.         if (panasw = 0) and (random(15) = 1) then
  35.           set panasw to 1
  36.         end if
  37.         set h1 to stagehright
  38.         set h0 to stagehright
  39.         set ah to -ah
  40.         set timeh to 0.0
  41.       end if
  42.     end if
  43.     if (v1 < stagehtop) and (av < 0.0) then
  44.       if (panasw = 0) and (random(15) = 1) then
  45.         set panasw to 1
  46.       end if
  47.       set v1 to stagehtop
  48.       set v0 to stagehtop
  49.       set av to -av
  50.       set timev to 0.0
  51.     else
  52.       if (v1 > stagehbottom) and (av > 0.0) then
  53.         if (panasw = 0) and (random(15) = 1) then
  54.           set panasw to 1
  55.         end if
  56.         set v1 to stagehbottom
  57.         set v0 to stagehbottom
  58.         set av to -av
  59.         set timev to 0.0
  60.       end if
  61.     end if
  62.     if panasw > 0 then
  63.       set panasw to panacharbound(h1, v1, ah, av, panasw)
  64.     end if
  65.     if pointandline(h00, v00, integer(h1), integer(v1)) then
  66.       exit repeat
  67.     end if
  68.     if pointandline(startholeh2, startholev2, integer(h1), integer(v1)) then
  69.       return 1
  70.     end if
  71.     movelochv(defsphead, h1, v1)
  72.     set h to h1 + hh
  73.     set v to v1 + vv
  74.     movelochv(defsphanafront, h, v)
  75.     movelochv(defsphanaback, h, v)
  76.     spriteBox(defspgomfront, h, v, h, v)
  77.     spriteBox(defspgomback, h, v, h, v)
  78.     updateStage()
  79.     set timeh to timeh + 0.40000000000000002
  80.     set timev to timev + 0.40000000000000002
  81.   end repeat
  82.   cursor(0)
  83.   panaheadcatch()
  84.   repeat while panasw <> 0
  85.     set panasw to panacharbound(h1, v1, ah, av, panasw)
  86.     Wait(2)
  87.     updateStage()
  88.   end repeat
  89.   return 0
  90. end
  91.  
  92. on panacharbound h0, v0, ah, av, panasw
  93.   if panasw = 1 then
  94.     set panacharh0 to h0
  95.     set panacharv0 to v0
  96.     set panacharha to ah / 1.69999999999999996 * 0.40000000000000002
  97.     set panacharva to av / 1.69999999999999996 * 0.40000000000000002
  98.     setpanacharlist()
  99.     set panacharcount to count(panacharlist)
  100.     set panacharend to (panacharcount * 5) + 4
  101.   end if
  102.   set c to (panasw / 10 * 2) + 1
  103.   if c <= panacharcount then
  104.     set t to panasw mod 10
  105.     if t = 1 then
  106.       set the castNum of sprite 31 to getAt(panacharlist, c)
  107.     end if
  108.     if (t >= 1) and (t <= 8) then
  109.       set t to t - 1
  110.       set h to panacharha * t
  111.       set v to panacharva * t
  112.       movelochv(31, panacharh0 + (t * panacharha), panacharv0 + (t * panacharva))
  113.     else
  114.       if t = 9 then
  115.         movelochv(31, -200, -200)
  116.       end if
  117.     end if
  118.   end if
  119.   set c to (panasw + 5) / 10 * 2
  120.   if (c > 0) and (c <= panacharcount) then
  121.     set t to (panasw - 5) mod 10
  122.     if t = 1 then
  123.       set the castNum of sprite 32 to getAt(panacharlist, c)
  124.     end if
  125.     if (t >= 1) and (t <= 8) then
  126.       set t to t - 1
  127.       set h to panacharha * t
  128.       set v to panacharva * t
  129.       movelochv(32, panacharh0 + (t * panacharha), panacharv0 + (t * panacharva))
  130.     else
  131.       if t = 9 then
  132.         movelochv(32, -200, -200)
  133.       end if
  134.     end if
  135.   end if
  136.   set panasw to panasw + 1
  137.   if panasw > panacharend then
  138.     set panasw to 0
  139.   end if
  140.   return panasw
  141. end
  142.  
  143. on pointandline h00, v00, h1, v1
  144.   if (abs(h1 - h00) < 30) and (abs(v1 - v00) < 30) then
  145.     return 1
  146.   end if
  147.   set h0 to the locH of sprite defsphead
  148.   set v0 to the locV of sprite defsphead
  149.   if (h0 = h00) and (v0 = v00) then
  150.     return 0
  151.   end if
  152.   if h0 < h1 then
  153.     set x0 to h0
  154.     set x1 to h1
  155.   else
  156.     set x0 to h1
  157.     set x1 to h0
  158.   end if
  159.   if v0 < v1 then
  160.     set y0 to v0
  161.     set y1 to v1
  162.   else
  163.     set y0 to v1
  164.     set y1 to v0
  165.   end if
  166.   if (x0 <= h00) and (h00 <= x1) and (y0 <= v00) and (v00 <= y1) then
  167.     if h0 = h1 then
  168.       return 1
  169.     else
  170.       set a to float(v1 - v0)
  171.       set b to float(h0 - h1)
  172.       set c to float((-b * v0) - (a * h0))
  173.       if (abs((a * h00) + (b * v00) + c) / sqrt((a * a) + (b * b))) < 30 then
  174.         return 1
  175.       end if
  176.     end if
  177.   end if
  178.   return 0
  179. end
  180.  
  181. on panaheadcatch
  182.   movelochv(defsphanaback, pananowh, pananowv)
  183.   movelochv(defsphanafront, pananowh, pananowv)
  184.   spriteBox(defspgomback, pananowh, pananowv, pananowh, pananowv)
  185.   spriteBox(defspgomfront, pananowh, pananowv, pananowh, pananowv)
  186.   set th to pananowh - getAt(panacatchh, (22 * (panadir - 1)) + 1)
  187.   set tv to pananowv - getAt(panacatchv, (22 * (panadir - 1)) + 1)
  188.   set step to (22 * (panadir - 1)) - 7
  189.   repeat with n = 9 to 28
  190.     movelochv(n, th + getAt(panacatchh, step + n), tv + getAt(panacatchv, step + n))
  191.   end repeat
  192.   updateStage()
  193. end
  194.  
  195. on panaheadpicup
  196.   set th to pananowh - getAt(panacatchh, (22 * (panadir - 1)) + 1)
  197.   set tv to pananowv - getAt(panacatchv, (22 * (panadir - 1)) + 1)
  198.   set step to (22 * (panadir - 1)) - 7
  199.   repeat with n = 10 to 28
  200.     movelochv(n, th + getAt(panapicuph, step + n), tv + getAt(panapicupv, step + n))
  201.   end repeat
  202.   updateStage()
  203. end
  204.  
  205. on pananoheadwalk block
  206.   set mh to (the left of sprite defsphead + the right of sprite defsphead) / 2
  207.   set mv to the bottom of sprite defsphead + getAt(panav, block + 1)
  208.   set d to getpanadir(mh, mv)
  209.   if d = -1 then
  210.   else
  211.     if d = 0 then
  212.       set d to panadir
  213.     end if
  214.     set panadir to d
  215.     set block to 22 * 8 * (panadir - 1)
  216.     repeat while 1
  217.       set d to getpanadir(mh, mv)
  218.       if d = -1 then
  219.         exit repeat
  220.       else
  221.         if d = 0 then
  222.           set d to panadir
  223.         else
  224.           if d = 3 then
  225.             set the visible of sprite defsphanafront to 0
  226.             set the visible of sprite defspgomfront to 0
  227.           else
  228.             set the visible of sprite defsphanafront to 1
  229.             set the visible of sprite defspgomfront to 1
  230.           end if
  231.         end if
  232.       end if
  233.       set panadir to d
  234.       set l to setwalkfigure(mh, mv, block, 10)
  235.       updateStage()
  236.       if l < 20 then
  237.         exit repeat
  238.       end if
  239.     end repeat
  240.   end if
  241.   if panadir = 3 then
  242.     set the visible of sprite defsphanafront to 0
  243.     set the visible of sprite defspgomfront to 0
  244.   else
  245.     set the visible of sprite defsphanafront to 1
  246.     set the visible of sprite defspgomfront to 1
  247.   end if
  248. end
  249.  
  250. on panabacktostage mh, mv
  251.   set backtostageh to 0
  252.   if mh < stagehleft2 then
  253.     set mh to stagehleft2
  254.     set backtostageh to 1
  255.   else
  256.     if mh > stagehright2 then
  257.       set mh to stagehright2
  258.       set backtostageh to 1
  259.     end if
  260.   end if
  261.   set backtostagev to 0
  262.   if mv < stagehtop2 then
  263.     set mv to stagehtop2
  264.     set backtostagev to 1
  265.   else
  266.     if mv > stagehbottom2 then
  267.       set mv to stagehbottom2
  268.       set backtostagev to 1
  269.     end if
  270.   end if
  271.   if (backtostageh + backtostagev) <> 0 then
  272.     set l to 0.0
  273.     set d to getpanadir(mh, mv)
  274.     if d = 3 then
  275.       set the visible of sprite defsphanafront to 0
  276.       set the visible of sprite defspgomfront to 0
  277.     else
  278.       set the visible of sprite defsphanafront to 1
  279.       set the visible of sprite defspgomfront to 1
  280.     end if
  281.     if d = -1 then
  282.     else
  283.       if d = 0 then
  284.         set d to panadir
  285.       end if
  286.       set panadir to d
  287.       set block to 22 * 8 * (panadir - 1)
  288.       repeat while 1
  289.         set d to getpanadir(mh, mv)
  290.         if d = -1 then
  291.           exit repeat
  292.         else
  293.           if d = 0 then
  294.             set d to panadir
  295.           else
  296.             if d = 3 then
  297.               set the visible of sprite defsphanafront to 0
  298.               set the visible of sprite defspgomfront to 0
  299.             else
  300.               set the visible of sprite defsphanafront to 1
  301.               set the visible of sprite defspgomfront to 1
  302.             end if
  303.           end if
  304.         end if
  305.         set panadir to d
  306.         movelochv(defsphanaback, pananowh, pananowv)
  307.         movelochv(defsphanafront, pananowh, pananowv)
  308.         set l to setwalkfigure(mh, mv, block, 9)
  309.         updateStage()
  310.         if l < 1 then
  311.           exit repeat
  312.         end if
  313.       end repeat
  314.     end if
  315.   end if
  316. end
  317.  
  318. on panaheadcutoff mh, mv, block
  319.   set h0 to pananowh - getAt(panah, block + 1)
  320.   set v0 to pananowv - getAt(panav, block + 1)
  321.   set av to -(mv - pananowv) / 2.0
  322.   set ah to -(mh - pananowh) / 5.0
  323.   set g to -8.0
  324.   set b to the bottom of sprite defsphead - v0
  325.   set b2 to the bottom of sprite defsphead - the locV of sprite defsphead
  326.   set hh to getAt(panah, block + 1) - getAt(panah, block + 2)
  327.   set vv to getAt(panav, block + 1) - getAt(panav, block + 2)
  328.   set h00 to h0
  329.   if mh = pananowh then
  330.     set mh to mh + power(-1, random(2))
  331.   end if
  332.   if mv = pananowv then
  333.     set mv to mv + power(-1, random(2))
  334.   end if
  335.   set da to -float(mv - pananowv) / float(mh - pananowh) * 0.20000000000000001
  336.   set t to 0.10000000000000001
  337.   set t2 to 1
  338.   set toph to v0
  339.   set panasw to 0
  340.   repeat while 1
  341.     set v to (av * t) - (g * t * t) + b + v0
  342.     set h to (ah * t) + h0
  343.     if v < toph then
  344.       set toph to v
  345.     end if
  346.     if v > v0 then
  347.       set t to (av - sqrt((av * av) + (4.0 * b * g))) / (2.0 * g)
  348.       set h to (ah * t) + h0
  349.       set h0 to h
  350.       set b to 0.0
  351.       set av to av * 0.90000000000000002
  352.       set ah to ah * 0.69999999999999996
  353.       if av > 0.0 then
  354.         set av to -av
  355.       end if
  356.       set t to 0.0
  357.       if (v0 - toph) < 15 then
  358.         set toph to -10000
  359.       else
  360.         set toph to v0
  361.       end if
  362.       if (panasw = 0) and (random(12) = 1) then
  363.         set panasw to 1
  364.       end if
  365.       next repeat
  366.     end if
  367.     set v to v - b2 + (da * -(h - h00))
  368.     movelochv(defsphead, h, v)
  369.     if panasw > 0 then
  370.       set panasw to panacharjumpout(h, v, ah, av, panasw)
  371.     end if
  372.     set h to h + hh
  373.     set v to v + vv
  374.     movelochv(defsphanafront, h, v)
  375.     movelochv(defsphanaback, h, v)
  376.     spriteBox(defspgomfront, h, v, h, v)
  377.     spriteBox(defspgomback, h, v, h, v)
  378.     updateStage()
  379.     if (t = 0.0) and (abs(startholeh2 - the locH of sprite defsphead) < 15) and (abs(startholev2 - the locV of sprite defsphead) < 15) then
  380.       return 1
  381.     end if
  382.     if toph = -10000 then
  383.       exit repeat
  384.     end if
  385.     set t to t + 0.40000000000000002
  386.     set t2 to t2 + 1
  387.   end repeat
  388.   repeat while panasw <> 0
  389.     set panasw to panacharjumpout(h, v, ah, av, panasw)
  390.     Wait(2)
  391.     updateStage()
  392.   end repeat
  393.   return 0
  394. end
  395.  
  396. on panacharjumpout h, v, ha, va, panasw
  397.   if panasw = 1 then
  398.     set panacharh0 to h
  399.     set panacharv0 to v
  400.     set panacharha to abs(ha) * 0.10000000000000001
  401.     set panacharva to abs(va) * 0.1285
  402.     setpanacharlist()
  403.     set panacharcount to count(panacharlist)
  404.     set panacharend to (panacharcount * 5) + 4
  405.   end if
  406.   set c to (panasw / 10 * 2) + 1
  407.   if c <= panacharcount then
  408.     set t to panasw mod 10
  409.     if t = 1 then
  410.       set the castNum of sprite 31 to getAt(panacharlist, c)
  411.     end if
  412.     if (t >= 1) and (t <= 8) then
  413.       set h to panacharha * t
  414.       set v to panacharva * t
  415.       movelochv(31, panacharh0 + getAt(panaboundh, t) + h, panacharv0 + getAt(panaboundv, t) - v)
  416.     else
  417.       if t = 9 then
  418.         movelochv(31, -200, -200)
  419.       end if
  420.     end if
  421.   end if
  422.   set c to (panasw + 5) / 10 * 2
  423.   if (c > 0) and (c <= panacharcount) then
  424.     set t to (panasw - 5) mod 10
  425.     if t = 1 then
  426.       set the castNum of sprite 32 to getAt(panacharlist, c)
  427.     end if
  428.     if (t >= 1) and (t <= 8) then
  429.       set h to panacharha * t
  430.       set v to panacharva * t
  431.       movelochv(32, panacharh0 - getAt(panaboundh, t) - h, panacharv0 + getAt(panaboundv, t) - v)
  432.     else
  433.       if t = 9 then
  434.         movelochv(32, -200, -200)
  435.       end if
  436.     end if
  437.   end if
  438.   set panasw to panasw + 1
  439.   if panasw > panacharend then
  440.     set panasw to 0
  441.   end if
  442.   return panasw
  443. end
  444.  
  445. on setpanacharlist
  446.   set r to random(6)
  447.   if r = 1 then
  448.     set panacharlist to cl_pana
  449.   else
  450.     if r = 2 then
  451.       set panacharlist to cl_sonic
  452.     else
  453.       if r = 3 then
  454.         set panacharlist to cl_fun_city
  455.       else
  456.         if r = 4 then
  457.           set panacharlist to cl_olympic
  458.         else
  459.           if r = 5 then
  460.             set panacharlist to cl_yawara_chan
  461.           else
  462.             set panacharlist to cl_time_capusule
  463.           end if
  464.         end if
  465.       end if
  466.     end if
  467.   end if
  468. end
  469.  
  470. on panaheadboing mh, mv, block
  471.   set i to 1
  472.   set h to 0
  473.   set v to 0
  474.   set step to block + 2
  475.   set th to pananowh - getAt(panah, block + 1) + getAt(panah, step)
  476.   set tv to pananowv - getAt(panav, block + 1) + getAt(panav, step)
  477.   repeat while 1
  478.     set h to (mh - pananowh) / i * power(-1, i)
  479.     set v to (mv - pananowv) / i * power(-1, i)
  480.     set h2 to h / 2
  481.     set v2 to v / 2
  482.     if ((h * h) + (v * v)) < 4 then
  483.       exit repeat
  484.     end if
  485.     movelochv(defsphanaback, pananowh + h2, pananowv + v2)
  486.     movelochv(defsphanafront, pananowh + h2, pananowv + v2)
  487.     setgomhana(pananowh + h, pananowv + v, pananowh + h2, pananowv + v2)
  488.     movelochv(defsphead, th + h, tv + v)
  489.     updateStage()
  490.     set i to i + 1
  491.   end repeat
  492. end
  493.