home *** CD-ROM | disk | FTP | other *** search
/ Champak 48 / cdrom_image.iso / Games / bossbash.swf / scripts / DefineSprite_737_game_dd / frame_1 / DoAction.as
Encoding:
Text File  |  2007-09-28  |  28.2 KB  |  1,134 lines

  1. function updateHealth()
  2. {
  3.    if(dude.hp > 0)
  4.    {
  5.       this.hud.bar._xscale = dude.hp / dude.maxx * 100;
  6.    }
  7.    else
  8.    {
  9.       this.hud.bar._xscale = 0;
  10.       dude.deceased = true;
  11.       if(!dude.onground)
  12.       {
  13.          dude.guts.gotoAndStop("fall");
  14.          dude.hitcount = 0;
  15.          dude.onground = true;
  16.          dude.Xvel = dude.guts._xscale / 100 * 50;
  17.       }
  18.    }
  19. }
  20. function chkHit(who, box)
  21. {
  22.    i = 0;
  23.    while(i < badz.length)
  24.    {
  25.       thing = eval(badz[i]);
  26.       if(who._y < thing._y + 10 && who._y > thing._y - 10)
  27.       {
  28.          if(box.hitTest(thing.guts.hitzone))
  29.          {
  30.             thing.guts._xscale = who.guts._xscale * -1;
  31.             thing.hp -= 1;
  32.             hitReact(who,thing);
  33.          }
  34.       }
  35.       i++;
  36.    }
  37. }
  38. function chkHitBig(who, box)
  39. {
  40.    swish4.start();
  41.    i = 0;
  42.    while(i < badz.length)
  43.    {
  44.       thing = eval(badz[i]);
  45.       if(who._y < thing._y + 10 && who._y > thing._y - 10)
  46.       {
  47.          if(box.hitTest(thing.guts.hitzone))
  48.          {
  49.             punch2.start();
  50.             thing.hp -= 7;
  51.             thing.guts._xscale = who.guts._xscale * -1;
  52.             hitReact(who,thing,true);
  53.          }
  54.       }
  55.       i++;
  56.    }
  57. }
  58. function testAboboHit(who, block, amt, fall)
  59. {
  60.    if(!dude.blinking)
  61.    {
  62.       if(who.ydist < 15)
  63.       {
  64.          if(block.hitTest(dude.guts.hitarea))
  65.          {
  66.             dude.guts._xscale = who.guts._xscale * -1;
  67.             who.hitcv = 0;
  68.             who.fcv = 0;
  69.             dude.hp -= amt;
  70.             updateHealth();
  71.             if(fall)
  72.             {
  73.                dude.guts.gotoAndStop("fall");
  74.                dude.hitcount = 0;
  75.                dude.onground = true;
  76.                dude.Xvel = dude.guts._xscale / 100 * 50;
  77.             }
  78.             else
  79.             {
  80.                dude.hitcount += 1;
  81.                if(dude.hitcount <= 3)
  82.                {
  83.                   dude.guts.gotoAndStop("hit");
  84.                   dude.beenhit = true;
  85.                   dude.Xvel = dude.guts._xscale / 100 * 30;
  86.                }
  87.                else
  88.                {
  89.                   dude.guts.gotoAndStop("fall");
  90.                   dude.hitcount = 0;
  91.                   dude.onground = true;
  92.                   dude.Xvel = dude.guts._xscale / 100 * 50;
  93.                }
  94.             }
  95.             h = _root.attachMovie("dd_hitlight","hit" + objcv,objcv + 99899);
  96.             h._xscale = 70;
  97.             h._yscale = h._xscale;
  98.             h._x = who._x + who.guts._xscale / 100 * -50;
  99.             h._y = who._y - 70;
  100.             objcv++;
  101.          }
  102.       }
  103.    }
  104. }
  105. function hitReact(who, thing, autofall)
  106. {
  107.    if(autofall)
  108.    {
  109.       thing.hitcount = 6;
  110.    }
  111.    thing.hitcount += 1;
  112.    if(thing.hitcount <= 6)
  113.    {
  114.       h = _root.attachMovie("dd_hitlight2","hit" + objcv,objcv + 9899999);
  115.       h._xscale = 70;
  116.       h._yscale = h._xscale;
  117.       h._x = who._x + who.guts._xscale / 100 * -50;
  118.       h._y = who._y - 70;
  119.       objcv += 1;
  120.       thing.beenhit = true;
  121.       thing.Xvel = who.guts._xscale / 100 * -2;
  122.       thing.guts.gotoAndStop("hit");
  123.       who.fighting = true;
  124.       thing.fighting = true;
  125.       thing.fcv = 0;
  126.       who.fcv = 0;
  127.    }
  128.    else
  129.    {
  130.       if(autofall)
  131.       {
  132.          thing.Xvel = who.guts._xscale / 100 * -30;
  133.       }
  134.       else
  135.       {
  136.          thing.Xvel = who.guts._xscale / 100 * -10;
  137.       }
  138.       thing.onground = true;
  139.       thing.guts.gotoAndStop("fall");
  140.       thing.hitcount = 0;
  141.    }
  142. }
  143. function ptimer(who)
  144. {
  145.    who.pcv += 1;
  146.    if(who.pcv >= 12)
  147.    {
  148.       who.punches = 0;
  149.       who.pcv = 0;
  150.       clearInterval(who.myInt);
  151.    }
  152. }
  153. function getWho()
  154. {
  155.    return dude;
  156. }
  157. function initGuy(who, sp, pspeed, maxh, maxg, shp)
  158. {
  159.    who.hp = shp;
  160.    who.maxx = who.hp;
  161.    who.Xvel = 0;
  162.    who.Yvel = 0;
  163.    who.speed = sp;
  164.    who.attcv = 0;
  165.    who.punchspeed = pspeed;
  166.    who.hitcv = 0;
  167.    who.maxstun = maxh;
  168.    who.groundcv = 0;
  169.    who.maxground = maxg;
  170.    who.punchcv = 0;
  171.    who.whichhand = 0;
  172.    who.hitcount = 0;
  173.    who.recovercv = 0;
  174.    who.dcv = 0;
  175. }
  176. function phys(who)
  177. {
  178.    who.swapDepths(who._y);
  179.    if(who.hitcount > 0)
  180.    {
  181.       who.recovercv += 1;
  182.       if(who.recovercv > 80)
  183.       {
  184.          who.hitcount = 0;
  185.          who.recovercv = 0;
  186.       }
  187.    }
  188.    if(who.Xvel != 0 && !who.beenhit && !who.onground && !who.punching || who.Yvel != 0 && !who.beenhit && !who.onground && !who.punching)
  189.    {
  190.       if(!who.attacking)
  191.       {
  192.          if(!who.carrying)
  193.          {
  194.             who.guts.gotoAndStop("walk");
  195.          }
  196.          else if(!who.pickingup)
  197.          {
  198.             if(!who.throwing)
  199.             {
  200.                who.guts.gotoAndStop("carry");
  201.             }
  202.             else
  203.             {
  204.                who.guts.gotoAndStop("throw");
  205.             }
  206.          }
  207.          else
  208.          {
  209.             who.guts.gotoAndStop("pickingup");
  210.          }
  211.       }
  212.    }
  213.    who.Xvel *= 0.6;
  214.    who.Yvel *= 0.6;
  215.    who._x += who.Xvel;
  216.    who._y += who.Yvel;
  217.    who.absx = Math.abs(who.Xvel);
  218.    if(who.absx < 0.05)
  219.    {
  220.       who.Xvel = 0;
  221.    }
  222.    who.absy = Math.abs(who.Yvel);
  223.    if(who.absy < 0.05)
  224.    {
  225.       who.Yvel = 0;
  226.    }
  227.    if(who.absy < 1 && who.absx < 1 && !who.attacking && !who.beenhit && !who.onground && !who.punching)
  228.    {
  229.       if(!who.carrying)
  230.       {
  231.          who.guts.gotoAndStop("rest");
  232.       }
  233.       else if(!who.pickingup)
  234.       {
  235.          if(!who.throwing)
  236.          {
  237.             who.guts.gotoAndStop("carryrest");
  238.          }
  239.          else
  240.          {
  241.             who.guts.gotoAndStop("throw");
  242.          }
  243.       }
  244.       else
  245.       {
  246.          who.guts.gotoAndStop("pickingup");
  247.       }
  248.    }
  249.    if(!who.outofbounds)
  250.    {
  251.       if(who._x <= 0)
  252.       {
  253.          who._x = 0;
  254.          who.goty = false;
  255.          who.gotx = false;
  256.       }
  257.       if(who._x >= 480)
  258.       {
  259.          who._x = 480;
  260.          who.goty = false;
  261.          who.gotx = false;
  262.       }
  263.       if(who._y <= 210)
  264.       {
  265.          who._y = 210;
  266.          who.goty = false;
  267.          who.gotx = false;
  268.       }
  269.       if(who._y >= 400)
  270.       {
  271.          who._y = 400;
  272.          who.goty = false;
  273.          who.gotx = false;
  274.       }
  275.    }
  276. }
  277. function bossai(who)
  278. {
  279.    if(!who.beenhit)
  280.    {
  281.       if(!who.onground)
  282.       {
  283.          if(dude._x < who._x)
  284.          {
  285.             if(who.xdist > 10)
  286.             {
  287.                who.guts._xscale = 100;
  288.             }
  289.          }
  290.          else if(who.xdist > 10)
  291.          {
  292.             who.guts._xscale = -100;
  293.          }
  294.          who.fcv += 1;
  295.          if(who.fcv >= 15)
  296.          {
  297.             who.fcv = 0;
  298.             who.fighting = false;
  299.             who.attacking = false;
  300.          }
  301.          who.xdist = Math.abs(who._x - dude._x);
  302.          who.ydist = Math.abs(who._y - dude._y);
  303.          if(who.ydist < 10 && !dude.onground)
  304.          {
  305.             if(who.xdist < 100)
  306.             {
  307.                who.fighting = true;
  308.             }
  309.          }
  310.          if(who.fighting)
  311.          {
  312.             if(!who.punching)
  313.             {
  314.                who.punching = true;
  315.                who.punchnum = random(2);
  316.             }
  317.             who.guts.gotoAndStop("punch" + who.punchnum);
  318.          }
  319.          if(!who.fighting)
  320.          {
  321.             who.dcv += 1;
  322.             if(who.dcv >= 50)
  323.             {
  324.                who.dcv = 0;
  325.                who.act = random(2);
  326.             }
  327.             if(who.act == 0 && !dude.deceased)
  328.             {
  329.                if(dude._x < who._x)
  330.                {
  331.                   who.dir = -1;
  332.                }
  333.                else
  334.                {
  335.                   who.dir = 1;
  336.                }
  337.                if(who.xdist > 50)
  338.                {
  339.                   if(!who.wait)
  340.                   {
  341.                      who.Xvel = who.speed * who.dir;
  342.                   }
  343.                   else
  344.                   {
  345.                      who.Xvel = who.speed * who.dir / 1.075;
  346.                   }
  347.                }
  348.                if(dude._y < who._y)
  349.                {
  350.                   who.ydir = -1;
  351.                }
  352.                else
  353.                {
  354.                   who.ydir = 1;
  355.                }
  356.                if(!who.wait)
  357.                {
  358.                   who.Yvel = who.speed * who.ydir;
  359.                }
  360.                else
  361.                {
  362.                   who.Yvel = who.speed * who.ydir / 1.075;
  363.                }
  364.             }
  365.             if(who.act == 1)
  366.             {
  367.                who.Xvel = 0;
  368.                who.Yvel = 0;
  369.             }
  370.          }
  371.       }
  372.       else if(who.hp > 0)
  373.       {
  374.          who.groundcv += 1;
  375.          if(who.groundcv >= who.maxground)
  376.          {
  377.             who.guts.gotoAndStop("getup");
  378.             if(who.groundcv >= who.maxground + 10)
  379.             {
  380.                who.hitcount = 0;
  381.                who.groundcv = 0;
  382.                who.onground = false;
  383.             }
  384.          }
  385.       }
  386.       else
  387.       {
  388.          who.groundcv += 1;
  389.          if(!who.dead)
  390.          {
  391.             who.blinkcv = 0;
  392.             who.numblinks = 0;
  393.             who.dead = true;
  394.          }
  395.          if(who.groundcv >= 25)
  396.          {
  397.             who.blinkcv += 1;
  398.             if(who.blinkcv > 2)
  399.             {
  400.                who.blinkcv = 0;
  401.                who.numblinks += 1;
  402.                who._visible = !who._visible;
  403.                if(who.numblinks >= 20)
  404.                {
  405.                   if(who != abobo)
  406.                   {
  407.                      numdeaths += 1;
  408.                   }
  409.                   who._visible = false;
  410.                   who.dead = true;
  411.                   delete who.onEnterFrame;
  412.                   who.unloadMovie();
  413.                   who.removeMovieClip();
  414.                   if(numdeaths == 2)
  415.                   {
  416.                      readyfor2ndround = true;
  417.                   }
  418.                   if(numdeaths == 4 && !abobo._visible)
  419.                   {
  420.                      trace("YOU WIN");
  421.                      runEnd();
  422.                   }
  423.                }
  424.             }
  425.          }
  426.       }
  427.    }
  428.    else
  429.    {
  430.       who.hitcv += 1;
  431.       if(who.hitcv >= who.maxstun)
  432.       {
  433.          who.hitcv = 0;
  434.          who.beenhit = false;
  435.       }
  436.    }
  437. }
  438. function ai0(who)
  439. {
  440.    if(who.fighting && !dude.onground)
  441.    {
  442.       if(!who.beenhit)
  443.       {
  444.          if(!who.onground)
  445.          {
  446.             who.attacking = true;
  447.             who.punchcv += 1;
  448.             if(who.punchcv >= who.punchspeed)
  449.             {
  450.                who.punchcv = 0;
  451.                who.guts.gotoAndStop("punch" + who.whichhand);
  452.                var pnummer = who.whichhand + 1;
  453.                var thinger = eval("swish" + pnummer);
  454.                thinger.setVolume(50);
  455.                thinger.start();
  456.                thinger.setVolume(50);
  457.                who.attcv = 0;
  458.                who.ydist = Math.abs(who._y - dude._y);
  459.                if(who.guts.punchtest.hitTest(dude.guts.hitarea) && who.ydist <= 10)
  460.                {
  461.                   if(!dude.blinking)
  462.                   {
  463.                      dude.guts._xscale = who.guts._xscale * -1;
  464.                      who.hitcv = 0;
  465.                      who.fcv = 0;
  466.                      if(who.whichhand == 0)
  467.                      {
  468.                         who.whichhand = 1;
  469.                      }
  470.                      else
  471.                      {
  472.                         who.whichhand = 0;
  473.                      }
  474.                      dude.hitcount += 1;
  475.                      dude.hp -= 2;
  476.                      updateHealth();
  477.                      if(dude.hitcount <= 3)
  478.                      {
  479.                         dude.guts.gotoAndStop("hit");
  480.                         dude.beenhit = true;
  481.                         dude.Xvel = dude.guts._xscale / 100 * 2;
  482.                      }
  483.                      else
  484.                      {
  485.                         dude.guts.gotoAndStop("fall");
  486.                         dude.hitcount = 0;
  487.                         dude.onground = true;
  488.                         dude.Xvel = dude.guts._xscale / 100 * 20;
  489.                      }
  490.                      h = _root.attachMovie("dd_hitlight","hit" + objcv,objcv + 777866);
  491.                      h._xscale = 70;
  492.                      h._yscale = h._xscale;
  493.                      h._x = who._x + who.guts._xscale / 100 * -50;
  494.                      h._y = who._y - 70;
  495.                      objcv++;
  496.                   }
  497.                }
  498.             }
  499.          }
  500.       }
  501.       who.fcv += 1;
  502.       if(who.fcv >= 15)
  503.       {
  504.          who.fcv = 0;
  505.          who.fighting = false;
  506.          who.attacking = false;
  507.          if(!who.onground)
  508.          {
  509.             who.guts.gotoAndStop("rest");
  510.          }
  511.       }
  512.       who.debug = "fighting";
  513.    }
  514.    if(!who.beenhit)
  515.    {
  516.       if(!who.onground)
  517.       {
  518.          if(who.attacking)
  519.          {
  520.             who.attcv += 1;
  521.             if(who.attcv >= 10)
  522.             {
  523.                who.attcv = 0;
  524.                who.guts.gotoAndStop("rest");
  525.             }
  526.          }
  527.          if(dude._x > who._x)
  528.          {
  529.             who.guts._xscale = -100;
  530.          }
  531.          else
  532.          {
  533.             who.guts._xscale = 100;
  534.          }
  535.          if(!who.fighting)
  536.          {
  537.             who.debug = "";
  538.          }
  539.          who.distx = Math.abs(who._x - dude._x);
  540.          who.disty = Math.abs(who._y - dude._y);
  541.          if(who.disty < 10 && who.distx < 80)
  542.          {
  543.             who.fighting = true;
  544.             who.fcv = 0;
  545.          }
  546.          if(!who.fighting)
  547.          {
  548.             if(!who.outofbounds)
  549.             {
  550.                who.dcv += 1;
  551.                if(who.dcv >= 50)
  552.                {
  553.                   who.dcv = random(50) - 10;
  554.                   who.dec = random(5);
  555.                   who.xgoal = random(450);
  556.                   who.ygoal = random(190) + 210;
  557.                }
  558.                if(who.dec == 0)
  559.                {
  560.                   if(who._x < who.xgoal)
  561.                   {
  562.                      who.Xvel += who.speed;
  563.                   }
  564.                   if(who._x > who.xgoal)
  565.                   {
  566.                      who.Xvel -= who.speed;
  567.                   }
  568.                   if(who._y < who.ygoal)
  569.                   {
  570.                      who.Yvel += who.speed;
  571.                   }
  572.                   if(who._y > who.ygoal)
  573.                   {
  574.                      who.Yvel -= who.speed;
  575.                   }
  576.                   who.goaldistx = Math.abs(who.xgoal - who._x);
  577.                   who.goaldisty = Math.abs(who.ygoal - who._y);
  578.                   if(who.goaldistx < 5 && who.goaldisty < 5)
  579.                   {
  580.                      who.dec = 1;
  581.                   }
  582.                }
  583.                if(who.dec == 1)
  584.                {
  585.                   who.Xvel = 0;
  586.                   who.Yvel = 0;
  587.                }
  588.                if(who.dec == 2)
  589.                {
  590.                   who.ygoal = dude._y;
  591.                   who.xgoal = dude._x + dude.guts._xscale / 100 * 100;
  592.                   who.dec = 0;
  593.                }
  594.                if(who.dec == 3)
  595.                {
  596.                   who.dec = 0;
  597.                }
  598.                if(who.dec == 4)
  599.                {
  600.                   who.dec = 1;
  601.                }
  602.             }
  603.             else
  604.             {
  605.                if(who._x < who.xgoal)
  606.                {
  607.                   who.Xvel += who.speed;
  608.                }
  609.                if(who._x > who.xgoal)
  610.                {
  611.                   who.Xvel -= who.speed;
  612.                }
  613.                if(who._y < who.ygoal)
  614.                {
  615.                   who.Yvel += who.speed;
  616.                }
  617.                if(who._y > who.ygoal)
  618.                {
  619.                   who.Yvel -= who.speed;
  620.                }
  621.                who.goaldistx = Math.abs(who.xgoal - who._x);
  622.                who.goaldisty = Math.abs(who.ygoal - who._y);
  623.                if(who.goaldistx < 5 && who.goaldisty < 5)
  624.                {
  625.                   who.dec = 1;
  626.                   who.outofbounds = false;
  627.                }
  628.             }
  629.          }
  630.       }
  631.       else if(who.hp > 0)
  632.       {
  633.          who.groundcv += 1;
  634.          if(who.groundcv >= who.maxground)
  635.          {
  636.             who.guts.gotoAndStop("getup");
  637.             if(who.groundcv >= who.maxground + 10)
  638.             {
  639.                who.hitcount = 0;
  640.                who.groundcv = 0;
  641.                who.onground = false;
  642.             }
  643.          }
  644.       }
  645.       else
  646.       {
  647.          who.groundcv += 1;
  648.          if(!who.dead)
  649.          {
  650.             who.blinkcv = 0;
  651.             who.numblinks = 0;
  652.             who.dead = true;
  653.          }
  654.          if(who.groundcv >= 25)
  655.          {
  656.             who.blinkcv += 1;
  657.             if(who.blinkcv > 2)
  658.             {
  659.                who.blinkcv = 0;
  660.                who.numblinks += 1;
  661.                who._visible = !who._visible;
  662.                if(who.numblinks >= 20)
  663.                {
  664.                   numdeaths += 1;
  665.                   who._visible = false;
  666.                   who.dead = true;
  667.                   delete who.onEnterFrame;
  668.                   who.unloadMovie();
  669.                   who.removeMovieClip();
  670.                   if(numdeaths == 2)
  671.                   {
  672.                      readyfor2ndround = true;
  673.                   }
  674.                   if(numdeaths == 4 && !abobo._visible)
  675.                   {
  676.                      trace("YOU WIN");
  677.                      runEnd();
  678.                   }
  679.                }
  680.             }
  681.          }
  682.       }
  683.    }
  684.    else
  685.    {
  686.       who.hitcv += 1;
  687.       if(who.hitcv >= who.maxstun)
  688.       {
  689.          who.hitcv = 0;
  690.          who.beenhit = false;
  691.       }
  692.    }
  693. }
  694. function secondRound()
  695. {
  696.    b = this.attachMovie("dd_bad0","bad0",9999);
  697.    b.outofbounds = true;
  698.    b._xscale = 44;
  699.    b._yscale = b._xscale;
  700.    b._x = -100;
  701.    b._y = 350;
  702.    b.xgoal = 250;
  703.    b.ygoal = 275;
  704.    initGuy(b,2.5,12,4,40,20);
  705.    b = this.attachMovie("dd_bad0","bad1",9998);
  706.    b.outofbounds = true;
  707.    b._xscale = 44;
  708.    b._yscale = b._xscale;
  709.    b._x = 600;
  710.    b._y = 350;
  711.    b.xgoal = 350;
  712.    b.ygoal = 375;
  713.    initGuy(b,2.5,12,4,40,50);
  714.    this.badz = new Array(bad0,bad1,abobo);
  715. }
  716. function barrelFall(who)
  717. {
  718.    barrel._x = who._x + who.guts._xscale / 100 * 30;
  719.    barrel._y = who._y + 3;
  720.    barrel.inair = true;
  721.    barrel.guts._y = -350;
  722.    barrel._visible = true;
  723.    who.carrying = false;
  724.    barrel.Xvel = who.guts._xscale / 100 * 2;
  725.    barrel.Yvel = 0;
  726.    barrel.bounce = 0;
  727. }
  728. function throwBarrel(who)
  729. {
  730.    if(barrel.numthrows == undefined)
  731.    {
  732.       barrel.numthrows = 0;
  733.    }
  734.    barrel.numthrows += 1;
  735.    barrel._x = who._x + who.guts._xscale / -100 * 50;
  736.    barrel._y = who._y + 1;
  737.    barrel.inair = true;
  738.    barrel.guts._y = -350;
  739.    barrel._visible = true;
  740.    if(barrel.numthrows < 5)
  741.    {
  742.       barrel.Xvel = who.guts._xscale / -100 * 10;
  743.    }
  744.    else
  745.    {
  746.       barrel.Xvel = who.guts._xscale / -100 * 20;
  747.    }
  748.    barrel.Yvel = 0;
  749.    barrel.bounce = 0;
  750. }
  751. function barrelP(who)
  752. {
  753.    who.swapDepths(who._y);
  754.    if(!who.inair)
  755.    {
  756.       who.shad._visible = true;
  757.       who.xdist = Math.abs(who._x - dude._x);
  758.       who.ydist = Math.abs(who._y - dude._y);
  759.       if(who.xdist < 50 && who.ydist < 30 && who._visible)
  760.       {
  761.          who.guts.gotoAndStop("lit");
  762.          dude.nearbarrel = true;
  763.       }
  764.       else
  765.       {
  766.          dude.nearbarrel = false;
  767.          who.guts.gotoAndStop("norm");
  768.       }
  769.    }
  770.    else
  771.    {
  772.       if(who.guts._y >= -150)
  773.       {
  774.          who.guts._y = -150;
  775.          who.Yvel *= -0.6;
  776.          hollowclank.start();
  777.          who.bounce += 1;
  778.       }
  779.       if(who.bounce < 3)
  780.       {
  781.          i = 0;
  782.          while(i < badz.length)
  783.          {
  784.             thing = eval(badz[i]);
  785.             if(who._y < thing._y + 15 && who._y > thing._y - 15)
  786.             {
  787.                if(who.guts.hitarea.hitTest(thing.guts.hitzone))
  788.                {
  789.                   punch2.start();
  790.                   thing.hp -= 7;
  791.                   thing.onground = true;
  792.                   thing.guts.gotoAndStop("fall");
  793.                   thing.hitcount = 0;
  794.                   thing.groundcv = 0;
  795.                   thing.Xvel = who.Xvel;
  796.                }
  797.             }
  798.             i++;
  799.          }
  800.       }
  801.       who._x += who.Xvel;
  802.       who.Xvel *= 0.97;
  803.       who.guts._y += who.Yvel;
  804.       who.Yvel += 5;
  805.       if(who.bounce >= 5)
  806.       {
  807.          who.guts._y = -150;
  808.          who.inair = false;
  809.          delete who.onEnterFrame;
  810.       }
  811.    }
  812. }
  813. function controls(who)
  814. {
  815.    if(!this.pausy)
  816.    {
  817.       if(who.blinking)
  818.       {
  819.          who.blinkcv += 1;
  820.          who.p1._visible = true;
  821.          p1._xscale = who.guts._xscale;
  822.          if(who.blinkcv >= 5)
  823.          {
  824.             who._visible = !who._visible;
  825.             who.blinkcv = 0;
  826.             who.deathtoll += 1;
  827.             if(who.deathtoll >= 23)
  828.             {
  829.                who.deathtoll = 0;
  830.                who.blinkcv = 0;
  831.                who.blinking = false;
  832.                who.p1._visible = false;
  833.                who._visible = true;
  834.             }
  835.          }
  836.       }
  837.       if(who.beenhit)
  838.       {
  839.          who.hitcv += 1;
  840.          if(who.hitcv >= who.maxstun)
  841.          {
  842.             who.hitcv = 0;
  843.             who.beenhit = false;
  844.          }
  845.       }
  846.       else if(!who.onground)
  847.       {
  848.          if(who.fighting)
  849.          {
  850.             who.fcv += 1;
  851.             if(who.fcv >= 10)
  852.             {
  853.                who.fcv = 0;
  854.                who.fighting = false;
  855.             }
  856.          }
  857.          if(!Key.isDown(65))
  858.          {
  859.             who.aup = true;
  860.          }
  861.          if(!who.attacking)
  862.          {
  863.             if(Key.isDown(39))
  864.             {
  865.                who.Xvel += who.speed;
  866.                who.guts._xscale = -100;
  867.             }
  868.             if(Key.isDown(37))
  869.             {
  870.                who.Xvel -= who.speed;
  871.                who.guts._xscale = 100;
  872.             }
  873.             if(Key.isDown(38))
  874.             {
  875.                who.Yvel -= who.speed;
  876.             }
  877.             if(Key.isDown(40))
  878.             {
  879.                who.Yvel += who.speed;
  880.             }
  881.          }
  882.          else
  883.          {
  884.             who.attcv += 1;
  885.             if(who.attcv >= who.punchspeed)
  886.             {
  887.                who.attcv = 0;
  888.                who.attacking = false;
  889.                who.uppercut = false;
  890.                who.gotoAndStop("rest");
  891.             }
  892.          }
  893.       }
  894.       else if(!who.deceased)
  895.       {
  896.          who.groundcv += 1;
  897.          if(who.groundcv >= who.maxground)
  898.          {
  899.             who.guts.gotoAndStop("getup");
  900.             if(who.groundcv >= who.maxground + 10)
  901.             {
  902.                who.groundcv = 0;
  903.                who.onground = false;
  904.             }
  905.          }
  906.       }
  907.       else
  908.       {
  909.          who.guts.gotoAndStop("fall");
  910.          who.groundcv += 1;
  911.          if(who.groundcv > 15)
  912.          {
  913.             who.deathtoll += 1;
  914.             if(!who.beenset)
  915.             {
  916.                who.blinkcv = 0;
  917.                who.beenset = true;
  918.             }
  919.          }
  920.          if(who.deathtoll >= 5)
  921.          {
  922.             who._visible = !who._visible;
  923.             who.deathtoll = 0;
  924.             who.blinkcv += 1;
  925.             if(who.blinkcv >= 10)
  926.             {
  927.                if(numlives == 1)
  928.                {
  929.                   reSpawn();
  930.                }
  931.                else
  932.                {
  933.                   youLose();
  934.                }
  935.             }
  936.          }
  937.       }
  938.    }
  939. }
  940. function reSpawn()
  941. {
  942.    trace("respawn");
  943.    who._x = 250;
  944.    who._y = 275;
  945.    who.blinking = true;
  946.    who.deathtoll = 0;
  947.    who.groundcv = 0;
  948.    who.onground = false;
  949.    who.beenset = false;
  950.    who.deceased = false;
  951.    numlives = 0;
  952.    who.hp = who.maxx;
  953.    updateHealth();
  954. }
  955. function youLose()
  956. {
  957.    dude._visible = false;
  958.    who.deathtoll = 0;
  959.    who.groundcv = 0;
  960.    who.onground = false;
  961.    who.beenset = false;
  962.    who.deceased = false;
  963.    who.hp = who.maxx;
  964.    this.pausy = true;
  965.    numlives = 0;
  966.    hud.numlives = 0;
  967.    i = 0;
  968.    while(i < badz.length)
  969.    {
  970.       var thing = eval(badz[i]);
  971.       thing.gotoAndStop("rest");
  972.       i++;
  973.    }
  974.    trace("YOU LOSE");
  975.    _root.lose();
  976. }
  977. function runEnd()
  978. {
  979.    this.pausy = true;
  980.    dude.guts.gotoAndStop("rest");
  981.    showtim = tim0;
  982.    lif = (dude.maxx * (numlives + 1) - (dude.maxx - dude.hp)) * 10;
  983.    _root.win(showtim,lif);
  984. }
  985. stop();
  986. dude.guts._xscale = -100;
  987. dude.pcv = 0;
  988. dude.which = 0;
  989. dude.punches = 0;
  990. dude.deathtoll = 0;
  991. dude.blinkcv = 0;
  992. dude.blinking = true;
  993. numdeaths = 0;
  994. numlives = 1;
  995. rcv = 0;
  996. tim0 = 5370;
  997. hud.swapDepths(999);
  998. objcv = 0;
  999. badz = new Array(bad0,bad1,abobo);
  1000. this.swish1 = new Sound(this);
  1001. swish1.attachSound("swish1.wav");
  1002. this.swish2 = new Sound(this);
  1003. swish2.attachSound("swish2.wav");
  1004. this.swish3 = new Sound(this);
  1005. swish3.attachSound("swish3.wav");
  1006. this.swish4 = new Sound(this);
  1007. swish4.attachSound("swish4.wav");
  1008. this.punch2 = new Sound(this);
  1009. punch2.attachSound("punch2.wav");
  1010. this.hollowclank = new Sound(this);
  1011. hollowclank.attachSound("hollowclank.wav");
  1012. this.varoop = new Sound(this);
  1013. varoop.attachSound("varoop");
  1014. var keyListener = new Object();
  1015. keyListener.onKeyDown = function()
  1016. {
  1017.    var _loc1_ = Key.getCode();
  1018.    who = getWho();
  1019.    if(!who.beenhit && !who.onground)
  1020.    {
  1021.       if(who.aup)
  1022.       {
  1023.          who.aup = false;
  1024.          if(_loc1_ == 65)
  1025.          {
  1026.             if(!who.carrying && !who.nearbarrel || !who.carrying && who.attacking)
  1027.             {
  1028.                if(!who.uppercut)
  1029.                {
  1030.                   if(who.pcv == 0)
  1031.                   {
  1032.                      who.myInt = setInterval(ptimer,100,who);
  1033.                   }
  1034.                   if(!who.attacking)
  1035.                   {
  1036.                      who.attacking = true;
  1037.                      who.attcv = 0;
  1038.                      if(who.which == 1)
  1039.                      {
  1040.                         who.guts.gotoAndStop("punch1");
  1041.                         swish1.setVolume(50);
  1042.                         swish1.start();
  1043.                         swish1.setVolume(50);
  1044.                         who.which = 0;
  1045.                      }
  1046.                      else
  1047.                      {
  1048.                         who.guts.gotoAndStop("punch0");
  1049.                         swish2.setVolume(50);
  1050.                         swish2.start();
  1051.                         swish2.setVolume(50);
  1052.                         who.which = 1;
  1053.                      }
  1054.                      who.punches += 1;
  1055.                   }
  1056.                   if(who.punches > 4)
  1057.                   {
  1058.                      who.Xvel += who.guts._xscale / 100 * -20;
  1059.                      who.guts.gotoAndStop("punch2");
  1060.                      who.pcv = 0;
  1061.                      who.attcv = -10;
  1062.                      who.uppercut = true;
  1063.                      who.punches = 0;
  1064.                      clearInterval(who.myInt);
  1065.                   }
  1066.                }
  1067.             }
  1068.             else if(!who.nearbarrel)
  1069.             {
  1070.                if(!who.throwing && !who._parent.barrel.inair)
  1071.                {
  1072.                   who.throwing = true;
  1073.                   throwBarrel(who);
  1074.                }
  1075.             }
  1076.             else
  1077.             {
  1078.                who.carrying = true;
  1079.                who.pickingup = true;
  1080.                varoop.start();
  1081.                barrel._visible = false;
  1082.             }
  1083.          }
  1084.       }
  1085.    }
  1086. };
  1087. Key.addListener(keyListener);
  1088. initGuy(this.dude,3,5,4,40,50);
  1089. initGuy(this.bad0,2.5,12,4,40,20);
  1090. initGuy(this.bad1,2.5,12,4,40,20);
  1091. initGuy(this.abobo,1.8,12,4,40,90);
  1092. this.onEnterFrame = function()
  1093. {
  1094.    if(!this.pausy)
  1095.    {
  1096.       hud.numlives = this.numlives;
  1097.       phys(this.dude);
  1098.       i = 0;
  1099.       while(i < badz.length)
  1100.       {
  1101.          thing = this["bad" + i];
  1102.          phys(thing);
  1103.          ai0(thing);
  1104.          i++;
  1105.       }
  1106.       barrelP(barrel);
  1107.       phys(this.abobo);
  1108.       bossai(this.abobo);
  1109.       controls(this.dude);
  1110.       if(tim0 > 0)
  1111.       {
  1112.          tim0 -= 1;
  1113.       }
  1114.       tim = Math.floor(tim0 / 30);
  1115.       if(readyfor2ndround && !beendone)
  1116.       {
  1117.          rcv += 1;
  1118.          if(rcv > 15)
  1119.          {
  1120.             secondRound();
  1121.             beendone = true;
  1122.          }
  1123.       }
  1124.       if(abobo.hp > 0)
  1125.       {
  1126.          hud.bar2._xscale = abobo.hp / abobo.maxx * 100;
  1127.       }
  1128.       else
  1129.       {
  1130.          hud.bar2._xscale = 0;
  1131.       }
  1132.    }
  1133. };
  1134.