home *** CD-ROM | disk | FTP | other *** search
/ 600 Games / 600games.iso / Nave / peaceplane.swf / scripts / DefineSprite_124_baddy2 / frame_1 / DoAction.as
Encoding:
Text File  |  2006-09-05  |  1.0 KB  |  51 lines

  1. onEnterFrame = function()
  2. {
  3.    if(!setAll)
  4.    {
  5.       shootingTimer = 0;
  6.       health = 6;
  7.       vSpeed = 0;
  8.       setAll = true;
  9.    }
  10.    if(health > 0 && this.area.hitTest(_root.player.area))
  11.    {
  12.       health = 0;
  13.       _root.player.health = 0;
  14.    }
  15.    if(shootingTimer <= 0)
  16.    {
  17.       _root.globalsound.attachSound("fire");
  18.       _root.globalsound.start(0,1);
  19.       _root.makeBullet(_X - 50,_Y + 20);
  20.       shootingTimer = 50;
  21.    }
  22.    else
  23.    {
  24.       shootingTimer--;
  25.    }
  26.    _X = _X - _root.player.hSpeed;
  27.    if(health <= 0)
  28.    {
  29.       vSpeed++;
  30.       if(!exploded)
  31.       {
  32.          _root.explode(2,_X,_Y);
  33.          exploded = true;
  34.       }
  35.    }
  36.    _Y = _Y + vSpeed;
  37.    _X = _X - 3;
  38.    _rotation = (- vSpeed) * 5;
  39.    if(_Y >= 110 && health <= 0 && !dead)
  40.    {
  41.       _root.makeSplash(_X,120);
  42.       dead = true;
  43.       _root.score += 16;
  44.    }
  45.    if(_Y > 200 || _X < -100 || _X > 1000)
  46.    {
  47.       _root.baddyMax = _root.baddyMax + 1;
  48.       this.removeMovieClip();
  49.    }
  50. };
  51.