home *** CD-ROM | disk | FTP | other *** search
/ 404 Jogos / CLJG.iso / Aventura / sinta.swf / scripts / Monster.as < prev    next >
Encoding:
Text File  |  2008-08-08  |  23.7 KB  |  902 lines

  1. package
  2. {
  3.    import flash.display.*;
  4.    import flash.events.*;
  5.    import flash.text.*;
  6.    import flash.utils.*;
  7.    
  8.    [Embed(source="/_assets/assets.swf", symbol="Monster")]
  9.    public class Monster extends MovieClip
  10.    {
  11.        
  12.       
  13.       public var moveDown:Boolean;
  14.       
  15.       public var stopCount:int;
  16.       
  17.       public var hitWallRight:Boolean;
  18.       
  19.       public var charwidth:Number;
  20.       
  21.       public var monsterType:int;
  22.       
  23.       public var sleepTime:int;
  24.       
  25.       public var moveUp:Boolean;
  26.       
  27.       public var gravity:Number;
  28.       
  29.       public var inner:*;
  30.       
  31.       public var roared:Boolean;
  32.       
  33.       public var finished:Boolean;
  34.       
  35.       public var isAttacking:Boolean;
  36.       
  37.       public var dx:Number;
  38.       
  39.       public var dy:Number;
  40.       
  41.       public var wizdirection:String;
  42.       
  43.       public var oneFrame:*;
  44.       
  45.       public var moveRight:Boolean;
  46.       
  47.       public var alive:Boolean;
  48.       
  49.       public var generator:MonsterGenerator;
  50.       
  51.       public var curHealth:*;
  52.       
  53.       public var damType:*;
  54.       
  55.       public var animstate:String;
  56.       
  57.       public var testID:int;
  58.       
  59.       public var theTimer:Timer;
  60.       
  61.       public var startHealth:*;
  62.       
  63.       public var damage:*;
  64.       
  65.       public var moveLeft:Boolean;
  66.       
  67.       public var direction:int;
  68.       
  69.       public var col:int;
  70.       
  71.       public var hitWallLeft:Boolean;
  72.       
  73.       public var hidden:Boolean;
  74.       
  75.       public var stopped:Boolean;
  76.       
  77.       public var row:int;
  78.       
  79.       public var inAir:Boolean;
  80.       
  81.       public var game:PlatformGame;
  82.       
  83.       public var charheight:Number;
  84.       
  85.       public var walkSpeed:Number;
  86.       
  87.       public function Monster(param1:PlatformGame)
  88.       {
  89.          super();
  90.          addFrameScript(0,frame1,1,frame2,2,frame3,3,frame4,4,frame5,5,frame6,6,frame7,7,frame8,8,frame9,9,frame10,10,frame11);
  91.          game = param1;
  92.          finished = false;
  93.       }
  94.       
  95.       public function startTimer() : *
  96.       {
  97.          if(finished)
  98.          {
  99.             return;
  100.          }
  101.          sleepTime = Math.ceil(Math.random() * 3) + 3;
  102.          stopCount = 0;
  103.          if(theTimer == null)
  104.          {
  105.             theTimer = new Timer(1000,0);
  106.             theTimer.start();
  107.             theTimer.addEventListener(TimerEvent.TIMER,timerTick);
  108.          }
  109.       }
  110.       
  111.       public function shootCheck() : *
  112.       {
  113.          var _loc1_:Boolean = false;
  114.          if(finished)
  115.          {
  116.             return;
  117.          }
  118.          if(stopped && game.hero.alive)
  119.          {
  120.             _loc1_ = false;
  121.             if(game.getRowFromY(game.hero.mc.y) == game.getRowFromY(y))
  122.             {
  123.                if(direction == 1)
  124.                {
  125.                   if(x < game.hero.mc.x)
  126.                   {
  127.                      _loc1_ = true;
  128.                   }
  129.                }
  130.                if(direction == -1)
  131.                {
  132.                   if(x > game.hero.mc.x)
  133.                   {
  134.                      _loc1_ = true;
  135.                   }
  136.                }
  137.                if(_loc1_)
  138.                {
  139.                   inner.gotoAndPlay("attack");
  140.                   isAttacking = true;
  141.                   game.throwAxe(this);
  142.                }
  143.             }
  144.          }
  145.       }
  146.       
  147.       internal function frame10() : *
  148.       {
  149.          stop();
  150.       }
  151.       
  152.       public function regen() : *
  153.       {
  154.          endTimer();
  155.          init();
  156.          stopped = false;
  157.       }
  158.       
  159.       internal function frame3() : *
  160.       {
  161.          stop();
  162.       }
  163.       
  164.       internal function frame4() : *
  165.       {
  166.          stop();
  167.       }
  168.       
  169.       internal function frame7() : *
  170.       {
  171.          stop();
  172.       }
  173.       
  174.       internal function frame1() : *
  175.       {
  176.          stop();
  177.       }
  178.       
  179.       internal function frame6() : *
  180.       {
  181.          stop();
  182.       }
  183.       
  184.       internal function frame9() : *
  185.       {
  186.          stop();
  187.       }
  188.       
  189.       internal function frame2() : *
  190.       {
  191.          stop();
  192.       }
  193.       
  194.       internal function frame5() : *
  195.       {
  196.          stop();
  197.       }
  198.       
  199.       public function die() : *
  200.       {
  201.          if(finished)
  202.          {
  203.             return;
  204.          }
  205.          alive = false;
  206.          dx = dy = 0;
  207.          if(monsterType == 25 || monsterType == 27)
  208.          {
  209.             moveUp = false;
  210.             moveDown = true;
  211.             gravity = 0.02;
  212.          }
  213.          if(monsterType == 28)
  214.          {
  215.             game.wizardDead = true;
  216.             inner.movewiz.gotoAndPlay("die");
  217.             game.sounds.wizarddie.play();
  218.             inner.stop();
  219.          }
  220.          else
  221.          {
  222.             inner.gotoAndPlay("die");
  223.          }
  224.          if(monsterType == 27)
  225.          {
  226.             game.sounds.barbdie.play();
  227.          }
  228.          endTimer();
  229.       }
  230.       
  231.       internal function frame8() : *
  232.       {
  233.          stop();
  234.       }
  235.       
  236.       internal function frame11() : *
  237.       {
  238.          stop();
  239.       }
  240.       
  241.       public function timerTick(param1:Event) : *
  242.       {
  243.          if(finished)
  244.          {
  245.             return;
  246.          }
  247.          stopped = true;
  248.          if(alive)
  249.          {
  250.             shootCheck();
  251.             if(stopped)
  252.             {
  253.                ++stopCount;
  254.                if(stopCount >= sleepTime && !isAttacking)
  255.                {
  256.                   stopCount = 0;
  257.                   stopped = false;
  258.                   inner.gotoAndPlay("walk");
  259.                }
  260.             }
  261.             else
  262.             {
  263.                stopped = true;
  264.             }
  265.             return;
  266.          }
  267.       }
  268.       
  269.       public function resetBarboolia() : *
  270.       {
  271.          x = 4000;
  272.          y = 200;
  273.          if(game.diff == 0)
  274.          {
  275.             x = 5000;
  276.          }
  277.          roared = false;
  278.          alive = true;
  279.       }
  280.       
  281.       public function update(param1:Number) : *
  282.       {
  283.          var _loc2_:* = undefined;
  284.          var _loc3_:Number = NaN;
  285.          var _loc4_:Number = NaN;
  286.          var _loc5_:Number = NaN;
  287.          var _loc6_:int = 0;
  288.          var _loc7_:* = undefined;
  289.          var _loc8_:int = 0;
  290.          var _loc9_:int = 0;
  291.          if(finished)
  292.          {
  293.             return;
  294.          }
  295.          if(!alive && monsterType == 24)
  296.          {
  297.             dy = 0;
  298.          }
  299.          if((moveLeft || moveRight) && alive && !stopped)
  300.          {
  301.             if(monsterType != 26 && monsterType != 27)
  302.             {
  303.                isAttacking = false;
  304.             }
  305.             dx = direction * walkSpeed;
  306.          }
  307.          if(monsterType == 28)
  308.          {
  309.             if(oneFrame == 0)
  310.             {
  311.                ++oneFrame;
  312.             }
  313.             else if(oneFrame == 1)
  314.             {
  315.                ++oneFrame;
  316.                visible = true;
  317.                inner.gotoAndPlay(100);
  318.             }
  319.          }
  320.          if(stopped && alive)
  321.          {
  322.             dx = 0;
  323.             if(!isAttacking)
  324.             {
  325.                if(monsterType != 28)
  326.                {
  327.                   inner.gotoAndStop(1);
  328.                }
  329.                else
  330.                {
  331.                   inner.movewiz.gotoAndStop(1);
  332.                }
  333.             }
  334.          }
  335.          _loc2_ = dx * param1;
  336.          dy += gravity;
  337.          _loc3_ = dy * param1;
  338.          if(_loc3_ > 10)
  339.          {
  340.             _loc3_ = 10;
  341.          }
  342.          hitWallRight = false;
  343.          hitWallLeft = false;
  344.          inAir = true;
  345.          _loc4_ = y + _loc3_;
  346.          _loc5_ = x + _loc2_;
  347.          if(monsterType != 24 && monsterType != 25 && monsterType != 27 && monsterType != 28)
  348.          {
  349.             _loc6_ = 0;
  350.             while(_loc6_ < game.fixedObjects.length)
  351.             {
  352.                if((_loc7_ = game.fixedObjects[_loc6_]).blocktype < 11 || (_loc7_.blocktype > 61 && _loc7_.blocktype < 66 || _loc7_.blocktype == 52 || _loc7_.blocktype == 54) && !_loc7_.open)
  353.                {
  354.                   if(x + charwidth / 2 > _loc7_.leftside && x - charwidth / 2 < _loc7_.rightside)
  355.                   {
  356.                      if((monsterType == 22 || monsterType == 23) && Math.abs(_loc7_.topside - y) < 10)
  357.                      {
  358.                         if(direction == 1)
  359.                         {
  360.                            if(game.getTypeAt(_loc7_.col + direction,_loc7_.row) == 0 || game.getTypeAt(_loc7_.col + direction,_loc7_.row) > 10)
  361.                            {
  362.                               hitWallRight = true;
  363.                            }
  364.                         }
  365.                         else if(game.getTypeAt(game.getColFromX(x - charwidth / 2),_loc7_.row) == 0 || game.getTypeAt(game.getColFromX(x - charwidth / 2),_loc7_.row) > 10)
  366.                         {
  367.                            hitWallLeft = true;
  368.                         }
  369.                      }
  370.                      if(y <= _loc7_.topside && _loc4_ > _loc7_.topside)
  371.                      {
  372.                         _loc4_ = Number(_loc7_.topside);
  373.                         dy = 0;
  374.                         inAir = false;
  375.                         break;
  376.                      }
  377.                   }
  378.                }
  379.                _loc6_++;
  380.             }
  381.             if(_loc4_ > 440)
  382.             {
  383.                _loc4_ = 440;
  384.                dy = 0;
  385.                inAir = false;
  386.             }
  387.             _loc6_ = 0;
  388.             while(_loc6_ < game.fixedObjects.length)
  389.             {
  390.                if((_loc7_ = game.fixedObjects[_loc6_]).blocktype < 6 || _loc7_.blocktype == 53 || _loc7_.blocktype == 51 && monsterType != 26 || _loc7_.blocktype == 62 && !_loc7_.open)
  391.                {
  392.                   if(_loc4_ > _loc7_.topside && _loc4_ - charheight * 0.9 < _loc7_.bottomside)
  393.                   {
  394.                      if(x - charwidth / 2 >= _loc7_.rightside && _loc5_ - charwidth / 2 <= _loc7_.rightside)
  395.                      {
  396.                         _loc5_ = _loc7_.rightside + charwidth / 2;
  397.                         hitWallLeft = true;
  398.                         dx = 0;
  399.                         break;
  400.                      }
  401.                      if(x + charwidth / 2 <= _loc7_.leftside && _loc5_ + charwidth / 2 >= _loc7_.leftside)
  402.                      {
  403.                         _loc5_ = _loc7_.leftside - charwidth / 2;
  404.                         hitWallRight = true;
  405.                         dx = 0;
  406.                         break;
  407.                      }
  408.                   }
  409.                }
  410.                if(_loc7_.blocktype == 53)
  411.                {
  412.                   if(inner.hitbitbite.hitTestObject(_loc7_.block53))
  413.                   {
  414.                      takeDamage(150);
  415.                   }
  416.                }
  417.                _loc6_++;
  418.             }
  419.             if(_loc5_ > 630)
  420.             {
  421.                _loc5_ = 630;
  422.                hitWallRight = true;
  423.                dx = 0;
  424.             }
  425.             if(_loc5_ < 10)
  426.             {
  427.                _loc5_ = 10;
  428.                hitWallLeft = true;
  429.                dx = 0;
  430.             }
  431.             x = _loc5_;
  432.             y = _loc4_;
  433.             if(hitWallRight)
  434.             {
  435.                moveLeft = true;
  436.                direction = -1;
  437.                moveRight = false;
  438.             }
  439.             else if(hitWallLeft)
  440.             {
  441.                direction = 1;
  442.                moveLeft = false;
  443.                moveRight = true;
  444.             }
  445.          }
  446.          if(monsterType == 24)
  447.          {
  448.             if(!alive)
  449.             {
  450.                return;
  451.             }
  452.             dx = dy = 0;
  453.             _loc8_ = Math.abs(game.getColFromX(game.hero.mc.x) - game.getColFromX(x));
  454.             _loc9_ = Math.abs(game.getRowFromY(game.hero.mc.y) - game.getRowFromY(y));
  455.             if(_loc8_ <= 2 && _loc9_ <= 2 && hidden)
  456.             {
  457.                show();
  458.             }
  459.             else if((_loc8_ > 2 || _loc9_ > 2) && !hidden && !isAttacking)
  460.             {
  461.                hide();
  462.             }
  463.             if(!hidden && !isAttacking)
  464.             {
  465.                if(_loc8_ <= 1 && _loc9_ <= 1 && game.hero.alive)
  466.                {
  467.                   isAttacking = true;
  468.                   inner.gotoAndPlay("bite");
  469.                }
  470.             }
  471.             if(game.hero.mc.x > x && !hidden)
  472.             {
  473.                direction = 1;
  474.             }
  475.             if(game.hero.mc.x <= x && !hidden)
  476.             {
  477.                direction = -1;
  478.             }
  479.          }
  480.          if(monsterType == 25)
  481.          {
  482.             if(!alive)
  483.             {
  484.                inner.thread.visible = false;
  485.             }
  486.             else
  487.             {
  488.                visible = true;
  489.                inner.thread.scaleY = (440 - generator.y) / 440 * ((y - generator.y) / (440 - generator.y));
  490.             }
  491.             if(moveDown)
  492.             {
  493.                if(alive)
  494.                {
  495.                   inner.gotoAndStop(4);
  496.                }
  497.             }
  498.             if(moveUp)
  499.             {
  500.                dy = -walkSpeed;
  501.             }
  502.             if(moveDown && y > 420 && alive)
  503.             {
  504.                inner.gotoAndPlay("walk");
  505.                moveUp = true;
  506.                dy = 0;
  507.                moveDown = false;
  508.             }
  509.             if(moveUp && y < generator.y + 20)
  510.             {
  511.                moveUp = false;
  512.                dy = 0;
  513.                moveDown = true;
  514.             }
  515.             x = _loc5_;
  516.             y = _loc4_;
  517.          }
  518.          if(monsterType == 26)
  519.          {
  520.             _loc8_ = Math.abs(game.getColFromX(game.hero.mc.x) - game.getColFromX(x));
  521.             if((_loc9_ = Math.abs(game.getRowFromY(game.hero.mc.y) - game.getRowFromY(y))) == 0 && game.hero.alive)
  522.             {
  523.                if(game.hero.mc.x > x)
  524.                {
  525.                   direction = 1;
  526.                }
  527.                else
  528.                {
  529.                   direction = -1;
  530.                }
  531.             }
  532.             if(!isAttacking && alive)
  533.             {
  534.                if(_loc8_ <= 1 && _loc9_ <= 1 && game.hero.alive)
  535.                {
  536.                   isAttacking = true;
  537.                   inner.gotoAndPlay("attack");
  538.                }
  539.             }
  540.          }
  541.          if(monsterType == 27 && !game.wizardDead)
  542.          {
  543.             if(x > 1200 && x < 1400 && !roared)
  544.             {
  545.                roared = true;
  546.                game.sounds.barbroar.play();
  547.             }
  548.             _loc8_ = Math.abs(game.getColFromX(game.hero.mc.x) - game.getColFromX(x));
  549.             _loc9_ = game.getRowFromY(game.hero.mc.y) - game.getRowFromY(y);
  550.             if(alive && !game.hero.isPunched && !game.wizardDead)
  551.             {
  552.                if(_loc8_ > 1)
  553.                {
  554.                   dx = 0.2 * direction;
  555.                }
  556.                if(_loc9_ > 0)
  557.                {
  558.                   dy = 0.2;
  559.                }
  560.                if(_loc9_ < 0)
  561.                {
  562.                   dy = -0.2;
  563.                }
  564.                if(_loc9_ == 0)
  565.                {
  566.                   dy = 0;
  567.                }
  568.                if(game.hero.alive)
  569.                {
  570.                   if(game.hero.mc.x > x)
  571.                   {
  572.                      direction = 1;
  573.                      moveRight = true;
  574.                      moveLeft = false;
  575.                   }
  576.                   else
  577.                   {
  578.                      direction = -1;
  579.                      moveLeft = true;
  580.                      moveRight = false;
  581.                   }
  582.                }
  583.             }
  584.             if(!isAttacking && alive)
  585.             {
  586.                if(_loc8_ <= 3 && game.hero.alive)
  587.                {
  588.                   isAttacking = true;
  589.                   inner.gotoAndPlay("attack");
  590.                }
  591.             }
  592.             if(game.hero.isPunched)
  593.             {
  594.                dy = 0;
  595.             }
  596.             x += dx * param1;
  597.             y += dy * param1;
  598.          }
  599.          if(monsterType == 28)
  600.          {
  601.             _loc8_ = Math.abs(game.getColFromX(game.hero.mc.x) - game.getColFromX(inner.movewiz.x + x));
  602.             _loc9_ = game.getRowFromY(game.hero.mc.y) - game.getRowFromY(inner.movewiz.y + y);
  603.             if(alive)
  604.             {
  605.                if(game.hero.alive)
  606.                {
  607.                   if(game.hero.mc.x > inner.movewiz.x + x)
  608.                   {
  609.                      direction = 1;
  610.                      wizdirection = "right";
  611.                   }
  612.                   else
  613.                   {
  614.                      direction = -1;
  615.                      wizdirection = "left";
  616.                   }
  617.                }
  618.             }
  619.          }
  620.          else
  621.          {
  622.             scaleX = direction;
  623.          }
  624.       }
  625.       
  626.       public function takeDamage(param1:int) : *
  627.       {
  628.          if(monsterType == 28)
  629.          {
  630.             inner.movewiz.gotoAndPlay("hit" + wizdirection);
  631.             inner.stop();
  632.          }
  633.          if(alive && !hidden)
  634.          {
  635.             if(monsterType == 27)
  636.             {
  637.                game.sounds.barbhit.play();
  638.             }
  639.             curHealth -= param1;
  640.             if(curHealth <= 0)
  641.             {
  642.                curHealth = 0;
  643.                die();
  644.             }
  645.          }
  646.       }
  647.       
  648.       public function startWizardTimer() : *
  649.       {
  650.          if(finished)
  651.          {
  652.             return;
  653.          }
  654.          if(theTimer == null)
  655.          {
  656.             theTimer = new Timer(3000,0);
  657.             theTimer.start();
  658.             theTimer.addEventListener(TimerEvent.TIMER,wizShoot);
  659.          }
  660.       }
  661.       
  662.       public function show() : *
  663.       {
  664.          if(finished)
  665.          {
  666.             return;
  667.          }
  668.          isAttacking = false;
  669.          hidden = false;
  670.          inner.gotoAndPlay("show");
  671.       }
  672.       
  673.       public function bite() : *
  674.       {
  675.          if(finished)
  676.          {
  677.             return;
  678.          }
  679.          if(inner.hitbitbite.hitTestObject(game.hero.mc))
  680.          {
  681.             game.hero.takeDamage(1000,1,0.3,x);
  682.          }
  683.       }
  684.       
  685.       public function init() : *
  686.       {
  687.          var _loc1_:* = undefined;
  688.          dx = dy = 0;
  689.          gravity = 0.03;
  690.          alive = true;
  691.          stopped = false;
  692.          stopCount = 0;
  693.          hidden = false;
  694.          moveDown = moveUp = false;
  695.          switch(monsterType)
  696.          {
  697.             case 22:
  698.                direction = 1;
  699.                moveLeft = false;
  700.                moveRight = true;
  701.                _loc1_ = Math.random();
  702.                if(_loc1_ < 0.5)
  703.                {
  704.                   direction = -1;
  705.                   moveLeft = true;
  706.                   moveRight = false;
  707.                }
  708.                walkSpeed = 0.04;
  709.                startHealth = 20;
  710.                charwidth = 30;
  711.                charheight = 20;
  712.                damage = 20;
  713.                damType = 1;
  714.                break;
  715.             case 23:
  716.                stopped = true;
  717.                direction = 1;
  718.                moveLeft = false;
  719.                moveRight = true;
  720.                _loc1_ = Math.random();
  721.                if(_loc1_ < 0.5)
  722.                {
  723.                   direction = -1;
  724.                   moveLeft = true;
  725.                   moveRight = false;
  726.                }
  727.                walkSpeed = 0.16;
  728.                startHealth = 20;
  729.                charwidth = 40;
  730.                charheight = 40;
  731.                damage = 15;
  732.                damType = 1;
  733.                startTimer();
  734.                break;
  735.             case 24:
  736.                direction = 1;
  737.                moveLeft = false;
  738.                moveRight = false;
  739.                walkSpeed = 0;
  740.                startHealth = 40;
  741.                charwidth = 40;
  742.                charheight = 40;
  743.                damage = 40;
  744.                damType = 1;
  745.                hidden = true;
  746.                break;
  747.             case 25:
  748.                direction = 1;
  749.                moveLeft = false;
  750.                moveRight = false;
  751.                moveDown = true;
  752.                walkSpeed = 0.1;
  753.                startHealth = 20;
  754.                charwidth = 40;
  755.                charheight = 40;
  756.                damage = 15;
  757.                damType = 1;
  758.                gravity = 0.02;
  759.                visible = false;
  760.                break;
  761.             case 26:
  762.                direction = 1;
  763.                moveLeft = false;
  764.                moveRight = true;
  765.                _loc1_ = Math.random();
  766.                if(_loc1_ < 0.5)
  767.                {
  768.                   direction = -1;
  769.                   moveLeft = true;
  770.                   moveRight = false;
  771.                }
  772.                walkSpeed = 0.06;
  773.                startHealth = 120;
  774.                if(game.diff == 0)
  775.                {
  776.                   startHealth = 80;
  777.                }
  778.                charwidth = 30;
  779.                charheight = 40;
  780.                damage = 10;
  781.                damType = 1;
  782.                break;
  783.             case 27:
  784.                direction = 1;
  785.                moveLeft = false;
  786.                moveRight = true;
  787.                walkSpeed = 1.3;
  788.                startHealth = 90;
  789.                charwidth = 30;
  790.                charheight = 40;
  791.                damage = 20;
  792.                damType = 1;
  793.                resetBarboolia();
  794.                break;
  795.             case 28:
  796.                direction = 1;
  797.                moveLeft = moveRight = false;
  798.                walkSpeed = 0;
  799.                startHealth = 300;
  800.                if(game.diff == 0)
  801.                {
  802.                   startHealth = 300;
  803.                }
  804.                damType = 4;
  805.                charwidth = 120;
  806.                charheight = 100;
  807.                damage = 40;
  808.                oneFrame = 0;
  809.                visible = false;
  810.                wizdirection = "right";
  811.                startWizardTimer();
  812.                break;
  813.             case 29:
  814.             case 30:
  815.             case 31:
  816.             case 32:
  817.          }
  818.          curHealth = startHealth;
  819.       }
  820.       
  821.       public function wizShoot(param1:Event) : *
  822.       {
  823.          if(finished)
  824.          {
  825.             return;
  826.          }
  827.          if(!isAttacking && alive && game.hero.alive)
  828.          {
  829.             isAttacking = true;
  830.             game.sounds.wizardpreattack.play();
  831.             if(Math.abs(game.hero.mc.x - (inner.movewiz.x + x)) < 100)
  832.             {
  833.                inner.movewiz.gotoAndPlay("attackdown" + wizdirection);
  834.             }
  835.             else
  836.             {
  837.                inner.movewiz.gotoAndPlay("attackside" + wizdirection);
  838.             }
  839.          }
  840.       }
  841.       
  842.       public function endTimer() : *
  843.       {
  844.          if(theTimer != null)
  845.          {
  846.             theTimer.stop();
  847.             theTimer = null;
  848.          }
  849.       }
  850.       
  851.       public function punch() : *
  852.       {
  853.          if(finished)
  854.          {
  855.             return;
  856.          }
  857.          if(hitTestObject(game.hero.mc))
  858.          {
  859.             game.hero.takeDamage(20,1,14,x);
  860.             game.hero.getPunched();
  861.          }
  862.       }
  863.       
  864.       public function hide() : *
  865.       {
  866.          if(finished)
  867.          {
  868.             return;
  869.          }
  870.          isAttacking = false;
  871.          hidden = true;
  872.          inner.gotoAndPlay("hide");
  873.       }
  874.       
  875.       public function endIt() : *
  876.       {
  877.          endTimer();
  878.          finished = true;
  879.       }
  880.       
  881.       public function shootLightning(param1:*) : *
  882.       {
  883.          game.shootLightning(this,param1);
  884.       }
  885.       
  886.       public function endDie() : *
  887.       {
  888.          game.removeMonster(this);
  889.          if(generator != null)
  890.          {
  891.             --generator.monsterCount;
  892.             generator.resetTimer();
  893.          }
  894.          if(monsterType == 28)
  895.          {
  896.             game.killAllMonsters();
  897.             game.winGame();
  898.          }
  899.       }
  900.    }
  901. }
  902.