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

  1. if(startup == null)
  2. {
  3.    starty = _Y + 1;
  4.    startup = "done";
  5. }
  6. if(eval("_root.codeMC:colourActive") == "red" or eval("_root.codeMC:redSwitch") == "on")
  7. {
  8.    if(_Y < starty)
  9.    {
  10.       direction = 1;
  11.    }
  12.    if(_Y > starty + 100)
  13.    {
  14.       direction = -1;
  15.    }
  16.    _Y = _Y + 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.          if(eval("_root.codeMC:jumping") == "off")
  56.          {
  57.             setProperty("_root.playerMC", _Y, _Y + getProperty("_root.BackgroundMC", _Y));
  58.          }
  59.          if(getProperty("_root.playerMC", _Y) > eval("_root.codeMC:scrollPointLower"))
  60.          {
  61.             setProperty("_root.backgroundMC", _Y, getProperty("_root.backgroundMC", _Y) - getProperty("_root.playerMC", _Y) + eval("_root.codeMC:scrollPointLower"));
  62.          }
  63.          if(getProperty("_root.playerMC", _Y) < eval("_root.codeMC:scrollPointUpper"))
  64.          {
  65.             setProperty("_root.backgroundMC", _Y, getProperty("_root.backgroundMC", _Y) - getProperty("_root.playerMC", _Y) + eval("_root.codeMC:scrollPointUpper"));
  66.          }
  67.       }
  68.       else if(collision == "on")
  69.       {
  70.          if(inRange == "off" or xCollision == "off")
  71.          {
  72.             set("_root.CodeMC:platformActive",eval("_root.CodeMC:platformActive") - 1);
  73.             collision = "off";
  74.          }
  75.       }
  76.    }
  77. }
  78.