home *** CD-ROM | disk | FTP | other *** search
/ 404 Jogos / CLJG.iso / Aventura / redbeard.swf / scripts / DefineSprite_119 / frame_1 / DoAction.as
Encoding:
Text File  |  2008-09-12  |  3.1 KB  |  85 lines

  1. if(startup == null)
  2. {
  3.    startx = _X + 1;
  4.    startup = "done";
  5. }
  6. if(eval("_root.codeMC:colourActive") == "purple" or eval("_root.codeMC:purpleSwitch") == "on")
  7. {
  8.    if(_X < startx)
  9.    {
  10.       direction = 2;
  11.    }
  12.    if(_X > startx + 100)
  13.    {
  14.       direction = -2;
  15.    }
  16.    _X = _X + direction;
  17. }
  18. if(getProperty("_root.BackgroundMC", _X) + _X > 0 and getProperty("_root.BackgroundMC", _X) + _X < 450 and getProperty("_root.BackgroundMC", _Y) + _Y > 0 and getProperty("_root.BackgroundMC", _Y) + _Y < 300)
  19. {
  20.    if(eval("_root.codeMC:state") != "dead")
  21.    {
  22.       range = 10;
  23.       if(getProperty("_root.playerMC", _Y) > _Y + getProperty("_root.BackgroundMC", _Y) - range and getProperty("_root.playerMC", _Y) < _Y + getProperty("_root.BackgroundMC", _Y) + range)
  24.       {
  25.          inRange = "on";
  26.       }
  27.       else
  28.       {
  29.          inrange = "off";
  30.       }
  31.       if(getProperty("_root.playerMC", _Y) < _Y + getProperty("_root.BackgroundMC", _Y) and getProperty("_root.playerMC", _Y) + eval("_root.CodeMC:fallspeed") > _Y + getProperty("_root.BackgroundMC", _Y))
  32.       {
  33.          yCollision = "on";
  34.       }
  35.       else
  36.       {
  37.          yCollision = "off";
  38.       }
  39.       if(getProperty("_root.playerMC", _X) > _X + getProperty("_root.BackgroundMC", _X) and getProperty("_root.playerMC", _X) < _X + _width + getProperty("_root.BackgroundMC", _X))
  40.       {
  41.          xCollision = "on";
  42.       }
  43.       else
  44.       {
  45.          xCollision = "off";
  46.       }
  47.       if(inRange == "on" and xCollision == "on")
  48.       {
  49.          if(collision != "on")
  50.          {
  51.             set("_root.CodeMC:platformActive",eval("_root.CodeMC:platformActive") + 1);
  52.          }
  53.          collision = "on";
  54.          set("_root.CodeMC:currentGround",_Y + getProperty("_root.BackgroundMC", _Y));
  55.          setProperty("_root.playerMC", _Y, _Y + getProperty("_root.BackgroundMC", _Y));
  56.          if(eval("_root.codeMC:colourActive") == "purple" or eval("_root.codeMC:purpleSwitch") == "on")
  57.          {
  58.             if(getProperty("_root.playerMC", _X) > eval("_root.codeMC:scrollPoint") and direction == 2 or getProperty("_root.playerMC", _X) < eval("_root.codeMC:scrollPointLeft") and direction == -2)
  59.             {
  60.                if(getProperty("_root.playerMC", _X) > eval("_root.codeMC:scrollPoint") and direction == 2)
  61.                {
  62.                   setProperty("_root.backgroundMC", _X, getProperty("_root.backgroundMC", _X) - direction);
  63.                }
  64.                if(getProperty("_root.playerMC", _X) < eval("_root.codeMC:scrollPointLeft") and direction == -2)
  65.                {
  66.                   setProperty("_root.backgroundMC", _X, getProperty("_root.backgroundMC", _X) - direction);
  67.                }
  68.             }
  69.             else
  70.             {
  71.                setProperty("_root.PlayerMC", _X, getProperty("_root.PlayerMC", _X) + direction);
  72.             }
  73.          }
  74.       }
  75.       else if(collision == "on")
  76.       {
  77.          if(inRange == "off" or xCollision == "off")
  78.          {
  79.             set("_root.CodeMC:platformActive",eval("_root.CodeMC:platformActive") - 1);
  80.             collision = "off";
  81.          }
  82.       }
  83.    }
  84. }
  85.