home *** CD-ROM | disk | FTP | other *** search
/ Champak 132 (Alt) / Vol 132.iso / games / nameless.swf / scripts / DefineSprite_2165 / frame_1 / DoAction.as
Encoding:
Text File  |  2011-06-09  |  1.6 KB  |  82 lines

  1. if(!setVars)
  2. {
  3.    startY = _Y;
  4.    gg = 0;
  5.    setVars = true;
  6. }
  7. stop();
  8. onEnterFrame = function()
  9. {
  10.    if(_root.diff > 2000)
  11.    {
  12.       moveSpeed = 3;
  13.    }
  14.    else if(_root.diff > 1500)
  15.    {
  16.       moveSpeed = 4;
  17.    }
  18.    else if(_root.diff > 1000)
  19.    {
  20.       moveSpeed = 5;
  21.    }
  22.    else if(_root.diff > 500)
  23.    {
  24.       moveSpeed = 6;
  25.    }
  26.    if(_root.pauseMode == false)
  27.    {
  28.       if(_root.gameGo == true)
  29.       {
  30.          if(_currentframe == 1)
  31.          {
  32.             _rotation = _rotation + moveSpeed;
  33.          }
  34.          else
  35.          {
  36.             _rotation = 0;
  37.          }
  38.          g.play();
  39.          if(go == false)
  40.          {
  41.             gotoAndStop(1);
  42.             _X = random(Stage.width);
  43.             _Y = startY;
  44.             maxNum = _root.diff / 18;
  45.             num = random(_root.diff / 18);
  46.             if(num == 1 or gg >= maxNum)
  47.             {
  48.                gg = 0;
  49.                go = true;
  50.             }
  51.             gg++;
  52.          }
  53.          else
  54.          {
  55.             if(_root.diff > 0)
  56.             {
  57.                if(_root.cm.hit.hitTest(this) && _currentframe == 1)
  58.                {
  59.                   gotoAndStop(2);
  60.                   _root.health -= 15;
  61.                }
  62.             }
  63.             if(_currentframe == 1)
  64.             {
  65.                if(_Y > -50)
  66.                {
  67.                   _Y = _Y - moveSpeed;
  68.                }
  69.                else
  70.                {
  71.                   go = false;
  72.                }
  73.             }
  74.          }
  75.       }
  76.    }
  77.    else
  78.    {
  79.       g.stop();
  80.    }
  81. };
  82.